Page 1 of 1

mail() building headers.

Posted: Fri Feb 20, 2004 11:42 am
by jasonrusso
I've been using PHP's mail() function in several of my programs. I didn't notice until recently that if an email is undeliverable it gets returned to my servers root mail account or root@localhost How do I get undeliverables to return to the email address in the mailheaders? Here's an example of my email headers:

$msg = "test";
$subject = "test";
$email = "me@mydomain.com";

$adminmailheaders = "From: $email\n";
$adminmailheaders .= "CC: $ccemail\n";
$adminmailheaders .= "BCC: $bccemail\n";
$adminmailheaders .= "Reply-To: $email\n";
$adminmailheaders .= "Return-Path: $email\n";

mail($email,$subject,$msg,$adminmailheaders);

Posted: Fri Feb 20, 2004 11:48 am
by markl999
Try using \r\n instead of just \n

reply

Posted: Wed Feb 25, 2004 1:19 pm
by jasonrusso
That didn't work. Emails are still bouncing to my root email account. i noticed the return-path says: <> . Wierd. Never had this problem in Perl. I'm not alone though, I see other users on my server using PHP mail() and there's are bouncing to the root too.

Posted: Thu Feb 26, 2004 4:04 am
by twigletmac
Which OS are you using?

Mac