PHP mail() returns false / emails not delivered
PHP’s mail() function failed or emails never arrive (spam or rejected).
mail() returns falsePHP mail not workingCould not instantiate mail function Meaning
mail() only hands the message to the local MTA (sendmail/postfix). Many hosts disable it, and messages without SPF/DKIM from a matching domain are rejected or land in spam.
Common causes
- No local mail transfer agent
- Host blocks mail()
- From address not on your domain
- Missing SPF/DKIM/DMARC records
⚡ Quick fix
- Send via authenticated SMTP (PHPMailer/Symfony Mailer) or a transactional email API
- Use a From address on your own domain
- Add SPF/DKIM records
Detailed fix by platform
PHP
- Check
sendmail_pathin phpinfo() and the MTA log (/var/log/mail.log)
How to diagnose
- Return — Does mail() return false?
- Logs — What does the mail log say?
- DNS — SPF/DKIM present?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in PHP
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 12 Oct 2026