postfix to gmail with multiple user configuration

vim /etc/postfix/

#add this line

relayhost = []

smtp_sasl_auth_enable = yes

smtp_sasl_password_maps = hash:/etc/postfix/sasl_password

smtp_sasl_security_options = noanonymous

smtp_use_tls = yes

smtp_sasl_tls_security_options = noanonymous

smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt

vim /etc/postfix/sasl_password

postmap  /etc/postfix/sasl_password

/etc/init.d/postfix restart

check it

echo redhat | mail -s test

and its log look like as

Nov 22 13:23:30 desktop11 postfix/pickup[17825]: 61D21664E0: uid=0 from=<root>

Nov 22 13:23:30 desktop11 postfix/cleanup[18077]: 61D21664E0: message-id=<>

Nov 22 13:23:30 desktop11 postfix/qmgr[17826]: 61D21664E0: from=<>, size=453, nrcpt=1 (queue active)

Nov 22 13:23:30 desktop11 postfix/smtp[18080]: connect to[2607:f8b0:400e:c01::6d]:25: Network is unreachable

Nov 22 13:23:35 desktop11 postfix/smtp[18080]: 61D21664E0: to=<>,[]:25, delay=5.3, delays=0.1/0.05/2.9/2.3, dsn=2.0.0, status=sent (250 2.0.0 OK 1353570815 rk17sm1660101pbb.3)

Nov 22 13:23:35 desktop11 postfix/qmgr[17826]: 61D21664E0: removed

now see mail  in your gmail account

multiple user configuration

now we see multiple user with postfix

add the line in postfix file

vim /etc/postfix/

# Disable sending mail without authentication, and allow any destination if authenticated
smtpd_client_restrictions = permit_sasl_authenticated, reject_unauth_destination, reject
smtpd_sender_restrictions = permit_sasl_authenticated
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination

# Use different mail relays for the different logins
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay

[root@desktop11 postfix]# cat sasl_passwd

[root@desktop11 postfix]# postmap sasl_passwd

[root@desktop11 postfix]# cat sender_relay

[root@desktop11 postfix]# postmap sender_relay

[root@desktop11 postfix]# /etc/init.d/postfix restart

Shutting down postfix:                                     [  OK  ]

Starting postfix:                                          [  OK  ]

[root@desktop11 postfix]# echo redhat | mail -s test

[student@desktop11 ~]$ echo from student user | mail -s student user


About bpn4it

Feel Free in Linux. Bipin Patel Ahmadabad, Gujarat, India
This entry was posted in Bipin hands-on. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s