Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is related to an IIS server problem, or a PHP configuration, not php code.

I'm running an IIS6 server with PHP installed on it, the following php code will never send an email:

mail("", "hi", "thanks"); //...mail(address, subject, message)

The server this is running under has a valid SMTP server, I know because I can telnet to localhost:25 and send emails by directly talking to the protocol, so that's not an issue.

However, this code won't send. I've looked at my php.ini file, and it looks like it's all correct to me also:

[mail function]
SMTP = localhost
smtp_port = 25

edit: I can confirm that programming that speaks to the socket with the SMTP protocol also works, but the mail() function still refuses.

share|improve this question

If you are using Authentication in your php.ini file then you need to use SMTP authenticate Scripts to send out the mail from the server.

share|improve this answer

check to see if you smtp service is running on the server.

easiest way is to open a command window, start -> run -> cmd

telnet localhost 25

see if you get any response, if not you need to start your smtp service.

share|improve this answer
I mentioned I could telnet into the service in my question. – Incognito Nov 16 '10 at 21:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.