Unable to send e-mail.
is coming from drupal_mail() and it's considered to be very general and it may relate to many different things such as misconfiguration of your Drupal site, PHP configuration or SMTP service of your operating system.
The first thing to do, is to check mail system or Apache logs (e.g.
/var/log/apache2/error.log) for more details about the error, as you could simply be missing
sendmail it-self (unless you'd like to use any external SMTP service).
If your Drupal is hosted on your dedicated server and it's a brand new configuration, most likely you're missing SMTP server (since it's pointing to
localhost by default), unless you're planning to use the external one.
If it's your local development machine, either ignore the error (since it should work fine on the dedicated server), try installing MailCatcher, or you'll have to install SMTP server as stated above.
Here are few other suggestions:
- if using SMTP module, check if you've configured (see README file) it correctly, including the right server settings,
- check value of
mail_system variable, if it's overridden - reset it into default value (
drush vdel mail_system),
- check your PHP mail configuration (
php -i | grep -ie mail -e smtp) and confirm that
SMTP host and
smtp_port are correct,
check connectivity to your SMTP server by using
telnet $(php -r 'echo ini_get("SMTP") . " " . ini_get("smtp_port");')
to double check whether host is not down, resolved by the DNS, or not blocked by the firewall,
postfix, check if
httpd_can_sendmail is set to
setsebool httpd_can_sendmail 1).
Finally test your e-mail by the following PHP command:
php -r 'mail("email@example.com", "Mail test", "It works!");'
and check this page if the e-mail has been received.