【问题标题】:postfix sender dependent relayhost后缀发件人依赖的中继主机
【发布时间】:2014-11-25 22:55:56
【问题描述】:

我希望一个发送地址使用不同的 gmail 帐户,而所有其他地址都使用默认的 gmail 帐户。

正如大多数在线教程所说,这应该可以工作,但 postfix 使用所有电子邮件的默认 smtp 用户名和密码...

是否有任何关于 postfix 的文档可以提供帮助? 发件人依赖的 tls 加密似乎也不是一个选项......我错了吗?

### main.cf ###
relayhost = smtp.gmail.com:587
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
sender_dependent_relayhost_maps=/etc/postfix/senderDependentRelayHostMap

smtp_use_tls = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_note_starttls_offer = yes
smtp_tls_...

### senderDependentRelayHostMap ###
test@gmail.com smtp.gmail.com:587

### sasl_password ###
#per sender email stmp username and password
test@gmail.com test@gmail.com:testPass
#default route
smtp.gmail.com:587 default@site.com:defaultPass

【问题讨论】:

    标签: postfix-mta


    【解决方案1】:

    你必须在 Postfix 中配置Sender-Dependent SASL authentication。请将以下几行添加到您的main.cf

    #/etc/postfix/main.cf    
    #...
    smtp_sender_dependent_authentication = yes
    smtp_sasl_auth_enable = yes 
    smtp_sasl_password_maps = regexp:/etc/postfix/sasl_passwd 
    relayhost = smtp.gmail.com:587 
    smtp_tls_security_level = may 
    smtp_sasl_security_options =
    #...
    

    并使用以下内容创建/etc/postfix/sasl_passwd

    /^test@gmail.com$/  test@gmail.com:testPass
    /^/                 default@site.com:defaultPass
    

    重新加载后缀。

    如果您使用以下命令从test@gmail.comsomeone@yahoo.com 发送邮件

    echo "Hi Everyone"|mail -s "Test email" -r "test@gmail.com" someone@yahoo.com
    

    那么您的后缀服务器将使用在/etc/postfix/sasl_passwd 中配置的test@gmail.com 的密码进行身份验证。来自所有其他发件人的邮件将使用 default@site.com:defaultPass 进行身份验证

    参考:Postfix docs

    希望对您有所帮助。

    【讨论】:

    • 更近一点,我可以从测试帐户发送,但它会导致来自默认电子邮件帐户的所有其他电子邮件无限期地排队等待发送。我希望能够根据需要灵活地从 gmail 或 yahoo 发送(依赖于发件人的中继主机),但我不需要它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-30
    • 1970-01-01
    • 2017-10-03
    • 1970-01-01
    • 2015-06-23
    • 2021-02-12
    相关资源
    最近更新 更多