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'] = '%firstname.lastname@example.org
'; //use this email when sending mails
all mails are set out with email@example.com
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 ('%firstname.lastname@example.org
') 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.