我有一个电子邮件服务器,配置如下:
在 main.cf 文件中:
mydomain = example.com.au
myhostname = mail.example.com.au
myorigin = $mydomain
relay_domains = example.com.au, second-domain.com.au, third-domain.com.au
sender_dependent_relayhost_maps = hash:/etc/postfix/relay_maps
在relay_maps文件中:
@example.com.au example.mail.protection.outlook.com
@second-domain.com.au join-account.mail.protection.outlook.com
@third-domain.com.au join-account.mail.protection.outlook.com
当我发送测试电子邮件时如下
echo "Test body message" | mail -r [email protected] -s "Test" [email protected]
echo "Test body message" | mail -r [email protected] -s "Test" [email protected]
echo "Test body message" | mail -r [email protected] -s "Test" [email protected]
在邮件日志中,我得到以下内容:
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/pickup[21775]: BB74AE48E6: uid=0 from=<[email protected]>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/cleanup[21845]: BB74AE48E6: message-id=<641279e6.TdzLT/bSgjlhn7Bl%[email protected]>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/qmgr[21776]: BB74AE48E6: from=<[email protected]>, size=451, nrcpt=1 (queue active)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/smtp[21847]: BB74AE48E6: to=<[email protected]>, relay=example.mail.protection.outlook.com[104.47.71.202]:25, delay=2.2, delays=0.02/0/0.71/1.4, dsn=2.6.0, status=sent (250 2.6.0 <641279e6.TdzLT/bSgjlhn7Bl%[email protected]> [InternalId=26749056322659, Hostname=M] 9129 bytes in 0.316, 28.191 KB/sec Queued mail for delivery)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/qmgr[21776]: BB74AE48E6: removed
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/pickup[21775]: BFC53E48E7: uid=0 from=<second-domain.com.au>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/cleanup[21845]: BFC53E48E7: message-id=<641279e6.Sik6/lNpLuRRC7RY%second-domain.com.au>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/qmgr[21776]: BFC53E48E7: from=<second-domain.com.au>, size=461, nrcpt=1 (queue active)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/smtp[21848]: BFC53E48E7: to=<[email protected]>, relay=join-account.mail.protection.outlook.com [104.47.71.202]:25, delay=2.1, delays=0.03/0.01/0.69/1.4, dsn=2.6.0, status=sent (250 2.6.0 <641279e6.Sik6/lNpLuRRC7RY%second-domain.com.au> [InternalId=99643241270213, Hostname=] 9199 bytes in 0.250, 35.892 KB/sec Queued mail for delivery)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/qmgr[21776]: BFC53E48E7: removed
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/pickup[21775]: C009CE48E8: uid=0 from=<[email protected]>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/cleanup[21845]: C009CE48E8: message-id=<641279e6.lNkWMtQOKwv22cDQ%[email protected]>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/qmgr[21776]: C009CE48E8: from=<third-domain.com.au>, size=449, nrcpt=1 (queue active)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/smtp[21849]: C009CE48E8: to=<[email protected]>, relay=join-account.mail.protection.outlook.com [104.47.71.202]:25, delay=1.5, delays=0.03/0.01/0.5/0.94, dsn=2.6.0, status=sent (250 2.6.0 <641279e6.lNkWMtQOKwv22cDQ%[email protected]> [InternalId=86955907880957, Hostname=] 9088 bytes in 0.242, 36.660 KB/sec Queued mail for delivery)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/qmgr[21776]: C009CE48E8: removed
Rely 正在按预期工作。
但是,当我通过我们的应用程序从不同域发送电子邮件时,这些电子邮件始终来自[电子邮件受保护]。例如,当我从以下位置发送电子邮件时[电子邮件受保护]和[电子邮件受保护]从应用程序中,邮件日志显示电子邮件来自[电子邮件受保护]但在邮件电子邮件客户端上,发件人地址是[电子邮件受保护]。
我的问题如下:
- 日志中的发件人地址与我在 Outlook 中看到的不同。我在邮件日志中看到的发件人地址是信封的发件人地址,还是我在 Outlook 中看到的电子邮件的发件人地址?
- Postfix 中是否有设置可以更改信封以匹配应用程序设置的发件人地址?
- 或者这必须在发送电子邮件的应用程序/客户端上完成吗?我仍在试图弄清楚应用程序何时使用某些脚本(如 PHP)或是否使用 sendmail/mailx 发送电子邮件。
答案1
应用程序正在使用发送邮件发送电子邮件-t选项。电子邮件发件人地址、电子邮件至地址、主题、正文和附件在-t选项。
然而,没有地址的信封。这是固定的-F选项和地址信封。