Email not working with fresh Drupal install on Ubuntu 14.04

October 17, 2014 5k views

I created a Droplet using Ubuntu 14.04 and the 1-click Drupal Image. The image creates the server with Nginx, php-fm, and MySQL along with the latest version of Drupal (currently 7.32). Everything went well but I noticed soon after that Drupal cannot send emails. When I try to create a test user Drupal displays the following alert:

Unable to send e-mail. Contact the site administrator if the problem persists.

Can Ubuntu or PHP send mail for Drupal or do I need to set up a mail transfer agent like Sendmail or Postfix?

1 comment
  • Yes - you have two options, using the SMTP module for Drupal and configuring Postfix to allow connections from localhost. Or easier - update the permission on /etc/mailname which you'll find now only is readable for root. It's safe to allow change that to 644.

2 Answers

In order to send emails from your droplet, you'll need to have an MTA installed such as Postfix. You can install it by running:

sudo apt-get install postfix

Then, edit /etc/postfix/ and set inet_interfaces to loopback-only:

inet_interfaces = loopback-only

Finally, restart postfix:

sudo service postfix restart
  • I installed Postfix according to your instructions and it worked perfectly! Thanks for the help kamaln7!

  • No problem! Glad I could help :)

  • This worked for me too. So it seems that this default drupal image doesn't come with mail working properly. This seems like a bug that should be reported digital ocean.

Have another answer? Share your knowledge.