From 30d7d7185531fa4b68ece7f3b11ca855e1fd5b5a Mon Sep 17 00:00:00 2001 From: Mike Frysinger <vapier@gentoo.org> Date: Tue, 5 Dec 2006 21:19:57 +0100 Subject: [PATCH] allow dynamic e-mail "from" addresses when doing notification this patch allows you to use @USER@ / @NAME@ / @MAIL@ in the "from" address when sending a mail notification e-mail darcs-hash:20061205201957-5224c-5637d6412106cb16af8817f07c8c02e95e4b3088.gz --- inc/common.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/common.php b/inc/common.php index 711df9d11..8ca29b918 100644 --- a/inc/common.php +++ b/inc/common.php @@ -810,6 +810,7 @@ function saveOldRevision($id){ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){ global $lang; global $conf; + global $INFO; // decide if there is something to do if($who == 'admin'){ @@ -866,7 +867,12 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){ $text = str_replace('@DIFF@',$diff,$text); $subject = '['.$conf['title'].'] '.$subject; - mail_send($to,$subject,$text,$conf['mailfrom'],'',$bcc); + $from = $conf['mailfrom']; + $from = str_replace('@USER@',$_SERVER['REMOTE_USER'],$from); + $from = str_replace('@NAME@',$INFO['userinfo']['name'],$from); + $from = str_replace('@MAIL@',$INFO['userinfo']['mail'],$from); + + mail_send($to,$subject,$text,$from,'',$bcc); } /** -- GitLab