In inc/mail.php, In the function, mail_send I added the line:
$from = str_replace('%u',$_SERVER['REMOTE_USER'],$from);
Now, in conf/local.php when you set the mailfrom, to something like:
$conf['mailfrom'] = '%
u@hostname.foo'; //use this email when sending mails
all mails are set out with
username@hostname.foo email address. This is handy - becuase you can see who is making changes from the mail, as well as hit the reply button, if you have a question about the change.
This assumes that all registered users have a valid email address ('%
u@hostname.foo') on the system (which is managed by something else - like gforge in my case). If you don't have this setup, the addition to inc/mail.php doesn't harm anything, - but you should not use '%u' in the $conf['mailfrom'] setting.
-Robin