我目前已经configuration了postfix,以便所有的用户都能被本地机器转发,除了一个通过gmail转发的用户之外。 就此而言,我已经添加了以下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
/等/后缀/ relayhost_maps
user-one@localhost [smtp.gmail.com]:587
/等/后缀/ sasl_passwd
[smtp.gmail.com]:587 [email protected]:user-one-pass-at-google
我知道我可以使用smtp_sasl_password_maps将多个用户映射到多个密码,但这意味着所有的中继将由gmail完成,我特别希望所有的中继都由本地主机完成,但有些用户除外。
现在我想有一个用户两个@本地(等)中继通过谷歌自己的密码。 那可能吗?
将参数smtp_sender_dependent_authentication设置为yes 。 然后,您可以将用户发件人地址作为smtp_sasl_password_maps查找键。
参考文献: 官方文件和这个页面
实际上,您只需将sasl_passwd的密钥更改为基于用户的密钥即可。 根据您的示例,只需将两个用户添加到relayhost_maps文件并更改以下文件:
/等/后缀/ sasl_passwd
user-one@localhost [email protected]:user-one-pass-at-google user-two@localhost [email protected]:user-two-pass-at-google