Configure postfix with Gmail via Webmin

December 5, 2011

Configure postfix with Gmail via Webmin

This assumes the user has webmin installed and understands how to log in and use it. (Usually bring it up in a browser at https://localhost:10000 )

  • Make sure that postfix is installed. In Webmin this is done by going to “System”, “Software Packages” then clicking on “Package from APT” and entering “postfix”. And you may want to install “mailutils” to test the mail system out.
    • Click on Webmin “Refresh Modules” to get Postfix to show up.
  • 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 “[email protected]” (or @.com if using google apps). An entry should be added for each user that is expected to send mail.
  • Modify Config FilesClick 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
  • The easiest way to test sending email is to use the ‘mail’ program:
    sudo apt-get install mailutils
    echo "test" | mail -s 'Test 1' [email protected]
    # Then check the logs to see if it bounced or had a problem
    tail /var/log/mail.log

Thank you http://noisygecko.com/tech/using-gmail-as-mail-host-with-postfix-webmin !