diff --git a/common.inc.php b/common.inc.php index 73f1acfb..5e2b1806 100644 --- a/common.inc.php +++ b/common.inc.php @@ -967,6 +967,7 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array()) } require_once("Rmail/Rmail.php"); +require_once("Rmail/RFC822.php"); //this sends out an all-ready-to-go email, it does no substitution or changes or database lookups or anything function email_send_new($to,$from,$subject,$body,$bodyhtml="") { @@ -974,8 +975,13 @@ function email_send_new($to,$from,$subject,$body,$bodyhtml="") { $mail->setFrom($from); $mail->setSubject($subject); $mail->setText($body); - $mail->setHeader("Bounce-To",$from); - $mail->setReturnPath($from); + + $r=new Mail_RFC822($from); + $structure = $r->parseAddressList($from); + $s=$structure[0]; + $ret=sprintf("%s@%s",$s->mailbox,$s->host); + $mail->setReturnPath($ret); + $mail->setHeader("Bounce-To",$ret); //only add the html if we have it if($bodyhtml) {