我正在尝试获取一个可以正常工作的 Postfix,目前我正在处理日志中的以下错误:
postfix/qmgr[57927]: 0E37E7B9B9: from=<[email protected]>, size=250, nrcpt=1 (queue active)
postfix/virtual[71608]: 0E37E7B9B9: to=<userexample.com>, relay=virtual, delay=4898, delays=4898/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox)
postfix/cleanup[71617]: 7E2FB7BAB3: message-id=<[email protected]>
postfix/bounce[71610]: 0E37E7B9B9: sender delivery status notification: 7E2FB7BAB3
postfix/qmgr[57927]: 7E2FB7BAB3: from=<>, size=2338, nrcpt=1 (queue active)
postfix/qmgr[57927]: 0E37E7B9B9: removed
postfix/smtp[71623]: 7E2FB7BAB3: to=<[email protected]>, relay=<AWS SES SMTP Endpoint>, delay=0.3, delays=0.02/0.01/0.27/0.01, dsn=5.0.0, status=bounced (host <AWS SES SMTP Endpoint> said: 501 Invalid MAIL FROM address provided (in reply to MAIL FROM command))
此日志是我使用 Telnet 向自己发送电子邮件时生成的。电子邮件正确到达,但可以看到无法发送成功通知,因为我的中继拒绝了 FROM 域。
发生这种情况的原因是 Postfix 似乎以发件人的身份生成了这封电子邮件[email protected]
,但我的中继仅接受 格式的电子邮件@example.com
。或者我可能读错了日志,还有其他原因(可能是 FROM 为空?)
有没有办法在 Postfix 中设置它?我做了一些研究,但没有找到可行的解决方案。
Postfix 配置:
command_directory = /usr/local/sbin
compatibility_level = 3.8
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = /usr/local/share/doc/postfix
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/man
meta_directory = /usr/local/libexec/postfix
mydomain = example.com
myhostname = mail.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = host
myorigin = example.com
newaliases_path = /usr/local/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/local/share/doc/postfix
relayhost = <AWS SES SMTP endpoint>:587
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
shlib_directory = /usr/local/lib/postfix
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = encrypt
smtp_use_tls = yes
smtpd_relay_restrictions = permit_mynetworks, reject_unauth_destination
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = pgsql:/usr/local/etc/postfix/sql/virtual_alias_maps.cf
virtual_gid_maps = static:125
virtual_mailbox_base = /mnt/emails/postfix
virtual_mailbox_domains = pgsql:/usr/local/etc/postfix/sql/virtual_mailbox_domains.cf
virtual_mailbox_maps = pgsql:/usr/local/etc/postfix/sql/virtual_mailbox_maps.cf
virtual_uid_maps = static:125