need postfix changes for using gmail?

I am trying to setup gmail as my mail hosting for ALL domains i have. I dont want to host any mail in my server. So, i disabled Mail for domain

but i found this site:

enable transport mapping in Postfix by editing /etc/postfix/ adding or changing your configuration with regard to the following. To avoid entering a variable twice, search your existing file for variables you are adding. If you find one that exists already, just change it to match the new value as shown below. In the end, your file needs to contain the following:

smtp_sasl_auth_enable = yes

smtpd_sasl_local_domain = $myhostname

smtp_sasl_security_options = noanonymous

smtp_sasl_security_options =

smtp_sasl_tls_security_options = noanonymous

smtpd_sasl_application_name = smtpd

Disable DNS Lookupsdisable_dns_lookups = yes

Optional Address Mapping

for example may mdawg@localhost to

relayhost = []:587

transport_maps = hash:/etc/postfix/transport
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_per_site = hash:/etc/postfix/tls_per_site

smtp_generic_maps = hash:/etc/postfix/generic

Postfix 2.3 and later

smtpd_tls_security_level = may

smtpd_tls_security_level = encrypt

Obsolete, but still supported

smtpd_enforce_tls = yes

this is required to force the servers certification to be checked

smtpd_tls_ask_ccert = yes

Next create 3 new files:


Contents of /etc/postfix/transport:

# Contents of /etc/postfix/transport    #

This sends mail to Gmail smtp:[]:587

Contents of /etc/postfix/sasl_passwd:

# Contents of sasl_passwd    #


Contents of /etc/postfix/tls_per_site:

# Contents of /etc/postfix/tls_per_site    # REMEMBER: After changes run:

postmap /etc/postfix/tls_per_site MUST

as root, Run postmap on the three files you just created:

postmap /etc/postfix/transport

postmap /etc/postfix/sasl_passwd

postmap /etc/postfix/tls_per_site

Edit etc/postfix/ and add:

smtp unix - - n - - smtp
relay unix - - n - - smtp

are these changes need? or?

Hmm, it’s possible that would work, but that also takes some extra steps that you may not need (that makes the configuration more complex).

If all you need is for email to end up at Gmail, then you can accomplish that by simply setting up an MX record for your various domains that points to Gmail’s servers.


well, i see i cant send mail from server atm. What i need to activate for allowing sending mail from server too? do i need to install sendmail or?

What happens if you try to send mail from the server? What problems are you running into?


well… nothing happens… but i can see mail queue in webmin->postfix->mail queue
and when try to flush:

Forcing the attempted delivery of mail with the command /usr/sbin/postqueue -c /etc/postfix -f …

postqueue: warning: unable to look up public/qmgr: No such file or directory
postqueue: fatal: Cannot flush mail queue - mail system is down


Ah, so it sounds like something isn’t working right with Postfix.

Try logging into your server over SSH as root, and restart Postfix using:

/etc/init.d/postfix restart

After you do that – do any errors show up in the mail logs… either /var/log/maillog, or /var/log/mail.log?


Apr 20 04:06:25 pro1965 postfix/postfix-script: fatal: the Postfix mail system is not running
Apr 20 04:06:30 pro1965 postfix/postfix-script: fatal: the Postfix mail system is not running
Apr 20 04:06:30 pro1965 postfix/postfix-script: starting the Postfix mail system
Apr 20 04:06:30 pro1965 postfix/master[6865]: fatal: bind port 25: Address already in use

Hmm, that’s an unusual problem.

Have you made any changes to the mail system on your server? Or perhaps installed a different mail service other than Postfix?

What does this command show:

netstat -anpl | grep :25

tcp 0 0* LISTEN 3182/exim tcp 0 0 ::1:25 :::* LISTEN 3182/exim

i used service exim stop
chkconfig exim off
/etc/init.d/postfix restart
it seems working now… but… how can exim be installed?

hmm… seems it was already installed on centos 5.6 minimal

I don’t believe Exim is the default MTA on CentOS, so somehow it got enabled along the way :slight_smile:

I believe “Sendmail” is the default MTA on CentOS 5.x. They’ll be moving to using Postfix as the default on CentOS 6.

In any case, I’m glad that you got it working now!