I'm using the default configuration of postfix on Ubuntu 9.04, and I've been trying to configure Gmail to send email through my server.

I'm looking for a simple configuration for 10-15 users (like using a password file), but all the tutorials I have found have been too extensive and seem very enterprise-oriented.

I just need to configure postfix with AUTH/TLS that is compatible with gmail.

  • have you first set up gmail to forward email to your postfix server? Are you hoping to use the same username and passwords as your gmail users use with authentication in one place?
    – Patrick R
    Feb 10, 2010 at 1:33

1 Answer 1


We have Gmail for our office email and I route some of our email through our test servers. I've been running a setup similar to yours for a while but eventually plan to drop Gmail completely.

Google give you the first steps here:


Once you have google set up to rely email to your postfix server it's a simple matter of setting up postfix to handle the sendoff.

You'll need to create your accounts locally. This will take easy password control/updates away from your users unless you install postfixadmin. This might not even be an issue for you if you're only interested in relying email through this server.

You can get away with a config file as short as this:

sudo nano /etc/postfix/main.cf

myhostname = mail.somesite.com 
mydestination = $myhostname    
myorigin = $myhostname    
mynetworks  = locallhost
relay_domains = $mynetworks

This is the basic set up for delivery of email from gmail through your server and out to the recipient. Note that you need to set up a PTR record for your domain and IP. Otherwise other server's may reject your email.

Google will also let you set this up for individual accounts so that you can test with yours or a test account before setting the whole company up.

This setup does not cover receiving email. If someone replies to your emails you'll want to be sure that your mx records continue to point at gmails servers so you can check your email there.

Tail your mail log files. They'll help you make your final adjustments

tail -f /var/log/mail.log

Send an email from the gmail app and watch the logs in real time. They're pretty easy to read and very informative.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .