Re: Getting mail() to return false/0

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

 



Hello,

Paul Reinheimer said the following on 12/14/2004 11:49 PM:
I read that as, mail() will return true if PHP is able to connect to
the MTA, pass the message, and the MTA responds that the message was
accepted.

My understanding (or assumption) of how the MTA operates is that it
would not accept a message it did not know how to deliver, ie one with
an invalid destination address.

That being said, there is an article on builder.com with regards to
mail and PHP which states:

The mail() function will return true as long as it connects to the
specified SMTP server. This does not mean that the mail successfully
reached its intended recipient. The mail() function does not wait for
or report success/error codes from the SMTP server

This is not true under Unix/Linux as PHP does not establish an SMTP connection. It only pipes the message to the sendmail program (or an emulation). Sendmail may even try to deliver the message immediately but if it fails it may retry later or the message bounces to the return address, but the mail() function still returns true.


The mail function only returns false under Windows when the SMTP server does not accept the message for relay for a variety of possible reasons. Once the message is accepted for relay, even if the recipient address is invalid, the message may end up bouncing later, but the mail function still returns true.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--
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