This is another in the series documenting my setup of a new home server with the Linksprite pcDuino3 Nano. A listing for the entire series can be found here. More information on the pcDuino3 Nano can be found at Linksprite’s website and the pcDuino website. |
The next step in setting up my home server was to setup email so that I could relay messages from the server through gmail for monitoring purposes.
This is part of my pcDuino3 Nano series of posts but it should work for webmin on other systems.
Install Postfix from Webmin
From the Webmin menu select Un-used Modules (1), scroll down and select Postfix Mail Server (2). Then on the resulting page select Click Here to install (3).
This will install Postfix.
Go back to the Webmin menu and select Servers (1), Postfix Mail Server (2) and then SMTP Authentication And Encryption (3).
Enter “[smtp.gmail.com]:587” in the Send outgoing mail box (1), then enter your user name (2) and password (3) and press Save and Apply (4).
Back on the Postfix Mail Server page select Virtual Domains (1).
Then add a mapping file by selecting the radio button (1) next to Map specification and then select “…” to the right of the box (2) and it will bring up another window. In this window add a mapping file (3). I used /etc/postfix/generic. Then select Save (4) in that window and Save and Apply (5) in the original window.
This will take you back to the Postfix Mail Server page where you will again select Virtual Domain. This time you want to add a new mapping (1).
Add a description for the mapping (1), the local username (2) and the username it maps to (3). Then select Save Mapping (4). You will want to setup a mapping for any user on the server that will be sending mail. For alerting purposes root should be enough.
When you are done adding mappings select Save and Apply (1) to exit back to the main Postfix Mail Server page.
Now you want to select Edit Config Files (1).
You will be adding two sections to the main.cf file (1). Then above the smtp_sasl_password_maps line add “smtp_sasl_auth_enable=yes” (2). Then scroll to the bottom of the file.
At the bottom of the file add the lines below and make sure that there is a newline at the end (3). Then select Save (4).
##### client TLS parameters ##### |
Now everything should be setup to work. Testing is most easily done from a command prompt. ssh to the server and log into root. If you haven’t already you will need to install mailutils. Then use the command below to send a test message.
root@testshares:~# apt-get install mailutils <messages removed to save space> update-alternatives: using /usr/bin/mail.mailutils to provide /usr/bin/mailx (mailx) in auto mode. |
This message should end up in user1@gmail.com's mailbox. If it doesn’t you can use the tail command to see the log to see what happened.
root@testshares:~# tail /var/log/mail.log |
Thanks to Steve Stonebraker at http://brakertech.com/configure-postfix-with-gmail-via-webmin/ for documenting these instructions.