Configure postfix with Gmail via Webmin

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 !

5 Comments

  1. Hi

    Thank you for above information , I did same and every thing goes perfect , since two days I am not able to login to webmin web interface and getting the error “Missing Headers”, is there any way to resolve this issue , also I need to change the “Via Host ” for mail sending is there any command line that I can use .

    Thank you in advance for your help .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.