Re: Unable to send mail from PHP to AT&T e-mail address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shawn McKenzie wrote:
Edward Diener wrote:
Phpster wrote:

On Apr 21, 2009, at 20:32, Edward Diener <eldml@xxxxxxxxxxxxxx> wrote:

I have a PHP script which uses the PHP 'mail' function. When the
script's 'to' address is an AT&T address, such as my own as an AT&T
ISP customer, the mail never gets to me. If the 'to' address is
anything other than an AT&T address, the mail gets to the recipient.
The PHP code for sending the mail is essentially:

   $headers  = 'MIME-Version: 1.0' . "\r\n";
   $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
   $headers .= 'From: Some From Name <somefromname.com>';
   $to = 'mybellsouthaddress.net';
   $subject = 'Some Subject';
   $msg = 'Some Message';
   if(mail($to,$subject,$msg."\r\n\r\n",$headers))
       echo "good";
   else
       echo "bad";

In the actual PHP script the $to, $subject, and $msg are successfully
passed to the script from the client side as $_POST, $_POST and
$_FILES parameters respectively. I have just filled them in above so
that they can be seen as if they were part of the script. The script
always returns "good", so the mail function must be successful.

In my project, testing has reported that any attempt to use the
'mail' function on the server to send to an AT&T address fails to
reach the recipient, while all other addresses used in the testing
succeed in reaching the recipient. I can assert this to be the case
with my own AT&T address also. I have also checked my AT&T mailbox
online to make sure the mail is not being received as Spam.

Does anybody have an idea why using the 'mail' function succeeds with
all but AT&T $to addresses ? Naturally in the client-server
application on which I am working, sending mail from the server must
work for all $to addresses.

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

It might be that the server IP has been blacklisted with at&t as a
domain  from which spam is sent.
I have found out that the server adds a from header of
'nobody@xxxxxxxxxxxx' where 'myserver' is the name of the server. This
header gets placed first before the From header I supply in my PHP
script ( which should have had the form in the example above of
'somefromname@xxxxxxxxxxxx, my bad ).

Perhaps the AT&T mail server, when it sees the 'nobody@xxxxxxxxxxxx'
treats it as spam and does not deliver the mail to even the recipient's
spam mailbox.

I am not sure if it is normal for outgoing SMTP mail servers to
automatically add the 'nobody@xxxxxxxxxxxx' from address first in the
header, or even why it does so ? Does anybody know if this is normal for
mail servers to do this ? Evidently other incoming mail servers do not
react to the 'nobody@xxxxxxxxxxxx' in any way, so maybe AT&T is unique
in this.

Any light anyone can throw on the 'nobody@xxxxxxxxxxxx' address would be
most welcome.

It is using the apache user @ your host name as the default.  Try this:

ini_set('sendmail_from', 'whatever@xxxxxxxxxxxx');

I will try this but I do not understand why it should work. I have a 'From:...' entry in my headers. Why is this not being used as the primary from address and why is 'nobody@xxxxxxxxxxxx' being added instead as the first from address ? In other words, I can understand if I supply no 'From:...' header entry that a default 'nobody@xxxxxxxxxxxx' would be used but I do not understand why it is used even when I supply a 'From:...' header entry.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux