These steps are for shared hosting. They use the panel, not a root shell on a server.
"No mail arrives" has two very different causes: the server never sent it, or it sent it and the receiver refused. The mail log answers that in one line, and everything else follows from the answer.
tail -50 /var/log/mail.log
- status=sent - it left. The problem is delivery, not sending: see the article on mail landing in spam.
- status=bounced - the receiver refused, and the line says why.
- Nothing at all - the application never handed anything over.
When nothing reaches the log
PHP's mail() returns true when the local mail program ACCEPTED the message, which is not the same as sending it. If no mail program is installed, it returns false and most applications ignore that.
php -r 'var_dump(mail("you@example.com","test","body"));'
which sendmail
Use SMTP instead of mail()
Authenticated SMTP to your own mailbox is more reliable and far better delivered: the message is signed and comes from a server with a reputation, rather than from a web process.
Host: mail.yourdomain.com
Port: 465 (SSL) or 587 (TLS)
User: the full address
From: the SAME address
Test the path, not the form
swaks --to you@example.com --from noreply@yourdomain.com --server mail.yourdomain.com:587 -tls -au noreply@yourdomain.com
That tests SMTP directly and prints the whole conversation. If it works and the site still fails, the fault is in the application settings, not in the mail server.
mailq. A message stuck in the queue has been accepted and not yet delivered, and the queue names the reason it is waiting.
