On Mon, Jul 7, 2008 at 2:13 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Mon, Jul 7, 2008 at 1:50 PM, Jay Moore <[EMAIL PROTECTED]> wrote:
>> Greetings folks. I seem to be having a problem with PHP's mail() function
>> and sending 'From' headers properly. Here's my setup:
>>
> [snip!]
>>
>> I am getting bounce emails from certain ISPs (AOL, Roadrunner, some local
>> ISPs) saying the sender's domain does not exist. It seems that either mails
>> are coming from my hostname ([EMAIL PROTECTED]), or those ISPs are
>> reading the additional headers incorrectly. Unfortunately, this is not
>> acceptable. People aren't getting their emails, and the hammer is coming
>> down on me.
>
>    Jay, try something like this:
>
> <?php
>
> $to = "[EMAIL PROTECTED]";
>
> $from = "[EMAIL PROTECTED]";
>
> $subject = "This is a test!";
>
> $body  = "\tThis is a test email.\n";
> $body .= "That is all.";
>
> $headers  = "From: ".$from."\r\n";
> $headers .= "Reply-To: ".$from."\r\n";
> $headers .= "X-Mailer: ".basename(__FILE__)."-PHP/".phpversion()."\r\n";
> $headers .= "Return-Path: ".$from."\r\n";
>
> mail($to,$subject,$body,$headers,'-f'.$from);
> ?>
>
>    Note the fifth parameter passed to mail():
>
>        http://php.net/mail
>
> --
> </Daniel P. Brown>
> Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
> $59.99/mo. with no contract!
> Dedicated servers, VPS, and hosting from $2.50/mo.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Yep!  Just a note on this though.  You have to control the domain
you're forcing the return-path on or else it will get rejected by a
lot of servers because of SPF rules.  It has bit my company in the
behind quite a bit recently.  :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to