Page 1 of 1

Settings bounceback address for the mail() function

Posted: Thu Feb 08, 2007 8:21 am
by impulse()
At the moment I have a script which e-mails several people. But if any of the addresses are undeliverable they bounce back to the server admin address. It was suggested that I set a "Reply-To" header, which I have, but the bouncebacks are still being sent to the server admin.

This is my header setup at the moment:

Code: Select all

$eol = "\r\n";

$headers .= "From: Calendar <noreply@mydomain.com.com>".$eol;
$headers .= "Reply-To: Calendar <noreply@mydomain.com.com>".$eol;
$headers .= "Return-Path: Calendar <noreply@mydomain.com.com>".$eol;
$headers .= "Message-ID: <".$now."noreply@mydomain.com.com>".$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;
noreply@mydomain.com is a valid e-mail address which I pickup, but nothing is being sent to there.

Any suggestions as to where I'm going wrong?

Regards,

Re: Settings bounceback address for the mail() function

Posted: Thu Feb 08, 2007 8:30 am
by volka
impulse() wrote:It was suggested that I set a "Reply-To" header, which I have, but the bouncebacks are still being sent to the server admin.
That's strange. What server is it?

Posted: Thu Feb 08, 2007 8:31 am
by impulse()
FreeBSD 6.1-RELEASE FreeBSD 6.1-RELEASE #0:

Posted: Thu Feb 08, 2007 8:46 am
by volka
Do you test the behaviour for sender and receiver on the same mail-server? i.e. you send from mydomain.com.com to mydomain.com.com and the mail should be bounced back to mydomain.com.com?

Posted: Thu Feb 08, 2007 8:47 am
by impulse()
No. The server the PHP script and the sendmail server are on are different to the server that receives the e-mails.

Posted: Thu Feb 08, 2007 8:56 am
by impulse()
I call mail 3 seperate times. The headers variable is always specified last in the arguments for the function and there are 4 arguments in total for the function that I have specified.

1. Sender address
2. Subject
3. Message
4. Headers

Does that all seem correct?

Posted: Thu Feb 08, 2007 8:59 am
by impulse()
I think I've found the problem but not the solution.

I've just looked at the headers for the e-mails I have received and they contain this line:

"Return-Path: <www@myServerDomain.com>"

Although this line is specified within the headers of my PHP file:

Code: Select all

$headers .= "Return-Path: Entanet Calendar <noreply@entagroup.com>".$eol;
:?:

Posted: Thu Feb 08, 2007 9:07 am
by volka
Take a look at rfc822. If memory serves there's something about return-path and the last relay.

Posted: Thu Feb 08, 2007 9:12 am
by impulse()
I think it's a Senmail configuration problem. Just had a look through Google and found this:

http://www.unitedforums.co.uk/vb/archiv ... t-787.html

I think Sendmail is overriding the Return-Path header.

Fix is to use "-f<returnaddress>" as the fifth argument in the mail() function.