PHP mail() timeout

Most likely you use 2 different php.ini versions. one for cli and one for cgi. Debian have this setup i believe.

  • /etc/php5/cgi/php.ini
  • /etc/php5/cli/php.ini

Make sure that your cli and cgi versions have the same email configuration and it will work.

The mail configuration key is: [mail function]

Another possibility is that your web user does't have access to execute sendmail.

Also check spool permissions (updated)


Do not rely on mail() as it is unreliable and leads to issues just like these. I've used phpMailer for years quite happily.

If you persist on mail() then check your settings in php.ini (explained at http://www.quackit.com/php/tutorial/php_mail_configuration.cfm). Note that usually CLI has a different php.ini than FastCGI.

Some more common problems:

  • FastCGI doesn't have permissions to use sendmail

  • Memory limit with large attachments

Tags:

Php

Email