Configure postfix with Gmail via Webmin

Configure postfix with Gmail via Webmin

If you like to install and update Webmin via APT, edit the /etc/apt/sources.list file on your system and add the lines :

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

You should also fetch and install a GPG key with which the repository is signed, with the commands :

cd /root
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc

You will now be able to install with the commands :

apt-get update
apt-get install webmin postfix ntpdate

All dependencies should be resolved automatically.

Now bring up your Webmin interface. (Usually bring it up in a browser at https://localhost:10000)

  • Add ‘pool.ntp.org’ for the NTP server in Hardware -> System time -> Time server sync.
  • Change the port number for Apache Server if you don’t want to use port 80. In Global Configuration, click on Networking and Addresses and change the Listen and Virtual server port to 8000 (or whichever port you prefer to use). Then click on the default server under Existing Virtual Hosts and change that port to 8000 as well (or whichever port you prefer to use).
  • Now change the SQL Administration password and the password for asteriskuser.
  • In Webmin click on “Servers”, “Postfix Mail Server”, “SMTP Authentication And Encryption”.
    • Enter “[smtp.gmail.com]:587 in the “Send outgoing email via host” entry box.
    • Check “Login as” and enter your Gmail user name and password.  (add @gmail.com to your username, if using google apps then add @.com)
  • Return to Postfix main page and click on “Virtual Domains”. Add a lookup table by clicking on the “…” next to “Map specifications”.
    • Check and enter a “Mapping file” of “/etc/postfix/generic”, then click “Save”. Click “Save and Apply”.
    • Now go to the “Virtual Domains” page again and click “Add a new mapping.”. Enter the local address to remote address mapping, for example “root@localhost” to “my_user@gmail.com” (or @.com if using google apps). An entry should be added for each user that is expected to send mail.
  • Return to Postfix main page and click on “Edit Config Files”. It should be editing “/etc/postfix/mail.cf” by default. Add this line above “smtp_sasl_password_maps=…” (order of entries seems to matter):

smtp_sasl_auth_enable=yes

Add this to the bottom of the “main.cf” file and click “Save” (make sure there is a new-line at the end):

##### client TLS parameters #####
smtp_tls_loglevel=1
smtp_tls_security_level=encrypt
smtp_sasl_security_options = noanonymous
smtp_generic_maps = hash:/etc/postfix/generic
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

References

http://brakertech.com/configure-postfix-with-gmail-via-webmin/