What are we doing?
Deploying Postfix with Mailutils to setup a send-only SMTP server on Ubuntu server
Why?
Applications hosted on our server will be able to send us notifications, password reset emails etc
Method
Update repositories and install mailutils
sudo apt-get update
sudo apt-get install mailutils
Hopefully you’re sure about this. When prompted, press
y
Big shiny screen. I guess there’s only one way forward
Accept the default ‘internet site’
Enter your FQDN
Lets change a few things in the Postfix config
sudo nano /etc/postfix/main.cf
Look for the line inet_interfaces = all and change it to
inet_interfaces = YOUR_SERVER_IP
This will allow us to send mail from any server on our subnet. If you plan to build everything on one machine, changing this line to inet_interfaces = localhost will allow only the local machine to send mail
ctrl
+ X
then y
to save
Restart postfix for changes to take effect
service postfix restart
Send a test email
echo "email body" | mail -s "Email subject" [email protected]
Don’t worry about receiving mail from root@mail, you will be able to specify a send from email address from your application.
Happy mailing!