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

Updated: 3 May, 2017 seen 842

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!

about

Hi! My name is Reinis Fischer (38), a proud dad and devoted husband. CEO and Founder of Terramatris crypto hedge fund, drone enthusiast, world traveler, photographer, and passionate lover of Georgian cuisine (vegetarian).

An ex-pat living in Georgia since 2011, I trade stocks, take photographs, work out at the gym, and many more. Here I write about travel, finance, and other things that might interest me.