Postfix Send Only SMPT Mail for Drupal 8 on Ubuntu 16.04, Nginx

| Servers | 8 seen

If you have recently installed a fresh Drupal 8 site on Ubuntu 16.04 with Nginx running on it and you are getting Unable to send e-mail. Contact the site administrator if the problem persists notice after submitting contact form, you are missing an important element for your site to functions properly.

You could be missing important information about available updates, as Drupal uses cron to sends notification e-mails once updates are available. The following written applies not only to Drupal sites, it basically applies for Nginx and Ubuntu 16.04. Since I was working with a Drupal 8 project when faced unable to send e-mail, I'm mentioning Drupal. 

Inspired by: Email not working with fresh Drupal install on Ubuntu 14.04

Anyhow, here is a simple fix, how to quickly enable mail send for your server.

Install Postfix in 3 simple steps

You will need to have access to your VPS, login with user with sudo priviligies​

sudo apt-get install postfix

Follow on screen instructions, leaving defaults 
Then, edit /etc/postfix/main.cf and set inet_interfaces to loopback-only

inet_interfaces = loopback-only

Finally, restart postfix:

sudo service postfix restart

That's it! You are good to go!

Add new comment