![配置 Postfix 根据域通过相同的中继发送不同的用户](https://linux22.com/image/651992/%E9%85%8D%E7%BD%AE%20Postfix%20%E6%A0%B9%E6%8D%AE%E5%9F%9F%E9%80%9A%E8%BF%87%E7%9B%B8%E5%90%8C%E7%9A%84%E4%B8%AD%E7%BB%A7%E5%8F%91%E9%80%81%E4%B8%8D%E5%90%8C%E7%9A%84%E7%94%A8%E6%88%B7.png)
我需要配置 postfix 通过中继服务器发送,但根据发送方域使用不同的用户。例如:
domain1.com
userA
passwordA
domain2.com
userB
passwordB
我需要发送中继服务器
这些是我未成功更改的文件:
/etc/postfix/transport
.domain1.com smtp:[relay.server.com] .domain2.com smtp:[relay.server.com]
在 /etc/postfix/sasl_passwd 文件中
@domain1.com userA:passwordA @domain2.com userB:passwordB
/etc/postfix/relayhost_map
domain1.com smtp:[relay.server.com] domain2.com smtp:[relay.server.com]
/etc/postfix/main.cf
mydomain = domain3.com myhostname = host.domain3.com myorigin = $mydomain relay_domains = relay.server.com, domain1.com, domain2.com relayhost = [relay.server.com] sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_map smtp_pix_workarounds = delay_dotcrlf smtp_sasl_auth_enable = yes smtp_sasl_mechanism_filter = !gssapi, !external, static:all smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous, noplaintext smtp_sasl_tls_security_options = $smtp_sasl_security_options smtp_sasl_type = cyrus smtp_sender_dependent_authentication = yes smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt smtp_use_tls = yes smtpd_sasl_path = smtpd smtpd_sasl_type = cyrus soft_bounce = no transport_maps = hash:/etc/postfix/transport unknown_local_recipient_reject_code = 550 virtual_alias_maps = hash:/etc/postfix/virtual
我收到的错误是:
Feb 13 19:04:43 postfixserver postfix/smtp[2718]: 95EE11607CC: to=<[email protected]>, relay=relay.server.com[X.X.X.X]:25, delay=0.28, delays=0/0.04/0.14/0.11, dsn=5.7.0, status=bounced (host relay.server.com[X.X.X.X] said: 530 5.7.0 authentication required in "MAIL FROM:<> SIZE=2263 BODY=8BITMIME" (in reply to MAIL FROM command))
似乎 sasl_passwd 映射定义不正确。提前致谢
答案1
我解决了对这些文件进行一些更改的问题:
我在域名前添加了“@”,并删除了服务器前的“smtp:”标签:
/etc/postfix/relayhost_map
@domain1.com [relay.server.com]
@domain2.com [relay.server.com]
我还更改了 main.cf 文件上的中继主机来跟踪配置是否正常工作。