[nycphp-talk] Emails not being received when using mail()
Hans Kaspersetz
hans at cyberxdesigns.com
Mon Jan 14 22:29:20 EST 2008
>
> Thanks, Hans. Here are the headers:
>
> Return-path: <nobody at mercury.hostspectrum.com>
> Envelope-to: recipient3 at example.com
> Delivery-date: Mon, 14 Jan 2008 19:49:12 -0600
> Received: from nobody by hosting.company.com with local (Exim 4.68)
> (envelope-from <nobody at mercury.hostspectrum.com>)
> id 1JEavQ-0007T3-9u; Mon, 14 Jan 2008 19:49:12 -0600
> To: recipient1 at example.com
> Subject: Newsletter Request
> From: me at example.com
> To: recipient2 at example.com
> Cc: recipient3 at example.com
> Reply-To: me at example.com
> Message-Id: <E1JEavQ-0007T3-9u at mercury.hostspectrum.com>
> Date: Mon, 14 Jan 2008 19:49:12 -0600
>
>
>
> // build additional headers
> $additionalHeaders = "From: me at example.com\r\n";
> $additionalHeaders .= "To: recipient2 at example.com\r\n";
> $additionalHeaders .= "Cc: recipient3 at example.com\r\n";
> $additionalHeaders .= "Return-Path: -f me at example.com\r\n";
> $additionalHeaders .= "Reply-To: me at example.com\r\n";
>
>
Well, as I suspected you definitely have some problems in your header
and the address the mail is coming from doesn't exist in the real
world. The first thing to correct is the line: $additionalHeaders .=
"Return-Path: -f me at example.com\r\n"; It is non-sense drop it all together.
Then make your mail() call something like this: $mailSent = mail($to,
$subject, $message, $additionalHeaders, "-f me at example.com"). It is a
little late any my eyes are dry, but that should go a long way to fixing
you up. However, this will only work if your host allows you to
override with the -f flag. Make the changes and send us the new headers.
In any event, you mail is not being routed by Google and the like
because your Return-Path is not being set to an address that exists in
the real world.
Hans
More information about the talk
mailing list