Postfix relay to multiple servers and multiple users

Posted by Frankie on Server Fault See other posts from Server Fault or by Frankie
Published on 2014-05-27T17:39:28Z Indexed on 2014/05/28 3:32 UTC
Read the original article Hit count: 441

Filed under:

I currently have postfix configured so that all users get relayed by the local machine with the exception of one user that gets relayed via gmail. To that extent I've added the following configuration:

/etc/postfix/main.cf

# default options to allow relay via gmail
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_sasl_security_options = noanonymous

# map the relayhosts according to user 
sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_maps

# keep a list of user and passwords
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

/etc/postfix/relayhost_maps

user-one@localhost   [smtp.gmail.com]:587

/etc/postfix/sasl_passwd

[smtp.gmail.com]:587  [email protected]:user-one-pass-at-google

I know I can map multiple users to multiple passwords using smtp_sasl_password_maps but that would mean that all relay would be done by gmail where I specifically want all relay to be done by the localhost with the exception of some users.

Now I would like to have a user-two@localhost (etc) relay via google with their own respective passwords. Is that possible?

© Server Fault or respective owner

Related posts about postfix