如何为每个发件人的SASLauthenticationconfigurationpostfix

我有两个Gmail帐户,我想configuration我的本地postfix服务器作为一个客户端,与smtp.gmail.com:587与凭据取决于发件人地址进行SASLvalidation。

所以,假设我的Gmail帐户是: [email protected][email protected] 。 如果我在FROM头域中发送了带有[email protected]的邮件,那么postfix应该使用凭证: [email protected]:psswd1通过gmail SMTP服务器进行SASLauthentication。 与[email protected]类似,它应该使用[email protected]:passwd2 。 听起来相当简单。

那么,我在http://www.postfix.org/SASL_README.html跟随了postfix官方文档,最后我得到了以下相关configuration:

/etc/postfix/main.cf中

  smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sender_dependent_authentication = yes sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay smtp_tls_security_level = secure smtp_tls_CAfile = /etc/ssl/certs/Equifax_Secure_CA.pem smtp_tls_CApath = /etc/ssl/certs smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache smtp_tls_session_cache_timeout = 3600s smtp_tls_loglevel = 1 tls_random_source = dev:/dev/urandom relayhost = smtp.gmail.com:587 

/等/后缀/ sasl_passwd

  [email protected] [email protected]:passwd1 [email protected] [email protected]:passwd2 smtp.gmail.com:587 [email protected]:passwd1 

/等/后缀/ sender_relay

  [email protected] smtp.gmail.com:587 [email protected] smtp.gmail.com:587 

完成configuration后,我做了:

  $ postmap /etc/postfix/sasl_passwd $ postmap /etc/postfix/sender_relay $ /etc/init.d/postfix restart 

问题是,当我从[email protected]发送邮件时,邮件结束于发件人地址为[email protected]而不是[email protected] ,这意味着postfix始终忽略每个发件人的configuration并使用默认凭证(上面的/etc/postfix/sasl_passwd的第三行)发送邮件。 我多次检查configuration,甚至将它们与各种博客文章中的相同问题进行比较,但发现它们与我的差不多。 那么,任何人都可以指出我正确的方向,以防万一我失去了一些东西?

非常感谢。

编辑

当我从[email protected]发送邮件到另一个“混淆的”邮件地址时,这是进入/var/log/mail.log的内容,[email protected]

  Sep 11 17:28:24 host postfix/pickup[13235]: D0E71A4167D: uid=1000 from=<marwan> Sep 11 17:28:24 host postfix/cleanup[13259]: D0E71A4167D: message-id=<20120911152824.GX10881@host> Sep 11 17:28:24 host postfix/qmgr[13236]: D0E71A4167D: from=<marwan@host>, size=413, nrcpt=1 (queue active) Sep 11 17:28:25 host postfix/smtp[13263]: setting up TLS connection to smtp.gmail.com[173.194.70.108]:587 Sep 11 17:28:25 host postfix/smtp[13263]: Verified TLS connection established to smtp.gmail.com[173.194.70.108]:587: TLSv1 with cipher RC4-SHA (128/128 bits) Sep 11 17:28:32 host postfix/smtp[13263]: D0E71A4167D: to=<[email protected]>, relay=smtp.gmail.com[173.194.70.108]:587, delay=7.8, delays=0.1/0/2.7/5, dsn=2.0.0, status=sent (250 2.0.0 OK 1347377285 25sm9995878bkx.9) Sep 11 17:28:32 host postfix/qmgr[13236]: D0E71A4167D: removed 

至于MAIL FROM命令,我注意到当我增加了日志级别时:

  Sep 11 18:26:53 host postfix/smtp[14287]: Write 42 chars: MAIL FROM:<marwan@host> SIZE=405 AUTH=<> 

那么,MAIL FROM命令是否应该包含[email protected]? 如果是这样,我该怎么做才能这样做。

顺便说一句,我没有编辑最后一行; 我的本地主机名是“主机”,我的本地使用名是“marwan”。

再次感谢。

后缀(实际上是任何MTA)不关心FROM头。
sender_dependent_relayhost_maps设置查看信封(SMTP MAIL FROM)地址。

请包括相关日志,显示您尝试使用其中一种例外发送邮件时发生的情况。

sasl_passwdsender_relay文件中为isp.mailcom添加[]

例如。

/etc/postfix/sasl_passwd

 [email protected] [email protected]:passwd1 [email protected] [email protected]:passwd2 [smtp.gmail.com]:587 [email protected]:passwd1 

/etc/postfix/sender_relay

 [email protected] [smtp.gmail.com]:587 [email protected] [smtp.gmail.com]:587