Re: Catching error from mail function?

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

 



Ben Cheng wrote:
Hi I'm using the mail() function to send email and I know it's failing because it's returning a false but how do I tell what problem is? Is there an error message that I can grab that will show me why the function is returning false? Any help greatly appreciated. Thanks!

The function itself doesn't return an error code, just true or false.

Things to check :

1. Current error reporting level. Set it to E_ALL to catch possible causes
3. Make sure your MTA is correctly setup on your server.
4. Make sure your php.ini file is correctly setup for your MTA. This means that for Windows servers, you have a valid smtp host specified in your php.ini file; for Unix/Linux, sendmail (or preferred MTA).
5. If your SMTP server requires authentication, you cannot use mail(), but must "manually" (via sockets) send your message. There are many classes available to do this. One is phpmailer found at phpmailer.sf.net
6. If possible, mail server logs.


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