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 sarge contrib
deb sarge contrib

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

cd /root
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 ‘’ 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 “[]:587 in the “Send outgoing email via host” entry box.
    • Check “Login as” and enter your Gmail user name and password.  (add to your username, if using google apps then add
  • 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 “” (or 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/” by default. Add this line above “smtp_sasl_password_maps=…” (order of entries seems to matter):


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

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