mgPePe mgPePe - 9 months ago 40
PHP Question

PHP mail does not get sent, how do I debug?

I have been trying to send email for registration, invitations and so on.

On local development, emails get sent. However once on the server no mails arrive.

I installed postfix. I was trying to setup a mail server but gave up. So currently, If I type in terminal

peter# mail

the email arrives. However, this does not send email:

$res = mail('', 'subj', 'bodddd');

not only that, but echoing
gives nothing. Neither

What and how do i do to make it working?


Answer Source

According to your comment above, it looks like your sendmail path is either wrong or commented out in your php.ini. It should be something like this:

sendmail_path = /usr/sbin/sendmail -t -i

If you're unsure where your sendmail binary resides, you may find it by using:

whereis sendmail