Shawn McKenzie wrote:
Edward Diener wrote:
Phpster wrote:


On Apr 21, 2009, at 20:32, Edward Diener <el...@tropicsoft.com> 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
'nob...@myserver.com' 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
'somefromn...@myserver.com, my bad ).

Perhaps the AT&T mail server, when it sees the 'nob...@myserver.com'
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 'nob...@myserver.com' 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 'nob...@myserver.com' in any way, so maybe AT&T is unique
in this.

Any light anyone can throw on the 'nob...@myserver.com' address would be
most welcome.

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

ini_set('sendmail_from', 'whate...@wherever.com');

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 'nob...@myserver.com' being added instead as the first from address ? In other words, I can understand if I supply no 'From:...' header entry that a default 'nob...@myserver.com' 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

Reply via email to