RHEL 8 系统上的 Sendmail 8.15。我可以发送邮件,但当我在另一端收到邮件时,“发件人”地址是 user@FQDN,而不是 user@MASQUARADE_AS
我们得到的是:[电子邮件保护]
我们想要的是:[电子邮件保护]
sendmail.mc 配置包含这些以及其他宏:
MASQUERADE_AS(`somedomain.com.au')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl
EXPOSED_USER(`root')dnl
FEATURE(masquerade_envelope)dnl
MASQUERADE_DOMAIN(somedomain.com.au)dnl
出于管理原因,我们确实希望将 root 用户显示为来自 FQDN 的用户,但我们希望所有其他用户显示为 user@MASQUERADE_AS,
测试配置,事情正如它们应该的那样出现:
> =SHdrFromL
R< @ > MAILER-DAEMON
R@ < @ $* > MAILER-DAEMON
R$+ $: $> AddDomain $1
R$* $: $> MasqHdr $1
> /tryflags HS
> /try local user
Trying header sender address user for mailer local
canonify input: user
Canonify2 input: user
Canonify2 returns: user
canonify returns: user
1 input: user
1 returns: user
HdrFromL input: user
AddDomain input: user
AddDomain returns: user < @ *LOCAL* >
MasqHdr input: user < @ *LOCAL* >
MasqHdr returns: user < @ somedomain . com . au . >
HdrFromL returns: user < @ somedomain . com . au . >
final input: user < @ somedomain . com . au . >
final returns: user @ somedomain . com . au
Rcode = 0, addr = [email protected]
> /try esmtp user
Trying header sender address user for mailer esmtp
canonify input: user
Canonify2 input: user
Canonify2 returns: user
canonify returns: user
1 input: user
1 returns: user
HdrFromSMTP input: user
PseudoToReal input: user
PseudoToReal returns: user
MasqSMTP input: user
MasqSMTP returns: user < @ *LOCAL* >
MasqHdr input: user < @ *LOCAL* >
MasqHdr returns: user < @ somedomain . com . au . >
HdrFromSMTP returns: user < @ somedomain . com . au . >
final input: user < @ somedomain . com . au . >
final returns: user @ somedomain . com . au
Rcode = 0, addr = [email protected]
>
我很困惑。我还需要查看其他配置指令吗?
是的,我在编辑 sendmail.mc 文件后确实运行了“make”。:)
somedomain.com.au 是我们邮件的外部可见出口点(spf 记录等)的 MX。
============================
使固定:
所以...我们最终通过这种方式解决了它:
发送邮件.mc:
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_AS(`somedomain.com.au')dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MASQUERADE_DOMAIN(`otherdomain.com')dnl
MASQUERADE_DOMAIN(`somehost.otherdoamin.com')dnl
提交.mc:
dnl define(`confDIRECT_SUBMISSION_MODIFIERS',`C')dnl
然后重新编译并重新启动,现在我们得到了所需的行为:外部用户会看到我们的邮件来自 somdomain.com.au