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

I'm having trouble getting my local XAMPP server to send emails via my remote SMTP server.

In PHP, if I put:

$headers  = "From:\r\n";
mail('', 'test', '', $headers);

Then this works. However, if I don't specify the header, ie.:

mail('', 'test', '');

Then this fails. The sendmail.log file says:

smtpstatus=554 smtpmsg='554 Message refused.' errormsg='the server did not accept the mail' exitcode=EX_UNAVAILABLE

I've tried changing my sendmail command in my php.ini to:

sendmail_path = "C:/xampp/sendmail/sendmail.exe -t -f"

but this doesn't work either.

Thanks for any help with this, Dan.

ps. this is on windows.

share|improve this question
dan, not the solution, but there any reason why you must use sendmail? i'd used to use sendmail , but i find the configuration a bit of headache, try postfix instead. – The Unix Janitor Apr 17 '10 at 11:41

From the PHP mail() documentation:

When sending mail, the mail must contain a From header. This can be set with the additional_headers parameter, or a default can be set in php.ini.

As far as your sendmail command line, I believe the -f directive and the address need to be together. i.e.:

Peace, Tom

share|improve this answer

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.