My php's mail() function just stopped working a short while ago. It's started returning FALSE.

I am not much of a sysadmin so please forgive my ignorance.

I set my php.ini send_path option to: "sendmail_path = /usr/sbin/sendmail -t -i" and restarted apache.

Then, I learned how to test sendmail like so:

sudo /usr/sbin/sendmail -bv mail@example.com mail@example.com... deliverable: mailer esmtp, host example.com., user mail@example.com

The example email is a real mail box.

I have also seen unknown user messages in the mail log.

Can anyone please help me debug this?

  • sendmail is a binary provided by all SMTP servers available for Linux systems. So you have to make sure that you are running sendmail (the mail server) or exim which also provides a sendmail binary. My guess is that you are running Exim, for it is installed by default on Debian systems. – adamo Jun 23 '12 at 8:43
  • The "user unknown" error message could indicate an SMTP email config problem. Telnet to your mail server on port 25 and attempt to send to the problem email account. You should get a specific SMTP error code. Please update your question with the error. – CIA Oct 27 '13 at 3:35

It would help if you tell which mailer system you are using so you can see if the messages are stalled in the queue. Is it really sendmail, postfix, qmail, exit, what?

Meanwhile, if you want try a replacement function for the mail() function, you may want to try the smtp_mail() function which is a wrapper to use this PHP MIME e-mail message class. It takes the same parameters as mail but uses a SMTP server that you can configure to route the message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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