Use RFC822 file from RMail to parse out the proper return path and set it

This commit is contained in:
james 2010-02-16 00:15:21 +00:00
parent 1d0b469dac
commit 48361e5868

View File

@ -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) {