Page 1 of 1

mail() function in PHP

Posted: Mon May 22, 2006 9:36 am
by Randolph
Hey guys,

3rd post. w00t! :twisted: :twisted:

I'm having trouble with the mail() function in PHP. We are running PHP on MS IIS 6.0, and the SMTP mail server runs on a different server than the web server. I entered the IP address of the SMTP server into the php.ini, but I am still not getting any success with the mail function. It appears to work, but I never receive any mail.

1) Is there a error syntax I can use to debug this? E.g., if it doesn't send mail, say why such as "Server not found"

2) Has anyone worked in a multi-server environment and had this problem?

Your input is always greatly appreciated.

Re: mail() function in PHP

Posted: Mon May 22, 2006 9:42 am
by Chris Corbyn
Randolph wrote:Hey guys,

3rd post. w00t! :twisted: :twisted:

I'm having trouble with the mail() function in PHP. We are running PHP on MS IIS 6.0, and the SMTP mail server runs on a different server than the web server. I entered the IP address of the SMTP server into the php.ini, but I am still not getting any success with the mail function. It appears to work, but I never receive any mail.

1) Is there a error syntax I can use to debug this? E.g., if it doesn't send mail, say why such as "Server not found"

2) Has anyone worked in a multi-server environment and had this problem?

Your input is always greatly appreciated.
Turn error reporting on full:

Code: Select all

error_reporting(E_ALL);
If there's no errors, check your SMTP logs to see that the mail actually sent to the server.

If it's getting that far it's likely being blocked as spam wrongly. That's because the headers often look funny. You could try something like phpMailer or Swift (see signature) if you want better debugging and handling without mail().