From 48361e5868ccd9fc8534d44f93912a5bc73ae337 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 16 Feb 2010 00:15:21 +0000 Subject: [PATCH] Use RFC822 file from RMail to parse out the proper return path and set it --- common.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) {