使用 上的“我忘记了密码”按钮时/admin/users/login
,所有发送到外部电子邮件地址的电子邮件都会失败。例如,如果用户有 的密码重置电子邮件,则me@internalDomain
重置代码会顺利发送。但是,如果他们有 的密码重置电子邮件,则me@externalDomain
它会失败。发送到外部域的所有其他类型的外发邮件均正常。
在邮件日志中,我看到发送普通邮件时,有一个发件人地址(<me@mydomain> -> <me@externalDomain>)
。发送密码重置邮件时,发件人地址为空白(<> -> me@externalDomain)
。
我们还使用 Dovecot、SendGrid 作为邮件中继,并使用 amavis 作为内容过滤器。由于发件人地址为空,SendGrid 的发件人授权拒绝了该电子邮件。有人知道如何设置密码重置的发件人地址吗?或者可能是什么设置错误导致仅在这种情况下发件人地址为空?
邮件日志
Oct 12 15:27:33 postfix-mail-server postfix/qmgr[4565]: 96547456D3: from=<>, size=1146, nrcpt=1 (queue active)
Oct 12 15:27:33 postfix-mail-server amavis[1890]: (01890-07) Passed CLEAN {RelayedOpenRelay}, [127.0.0.1]:48680 <> -> <[email protected]>, Queue-ID: 5B2FA45699, Message-ID: <[email protected]>, mail_id: zJxeBkdG8kSz, Hits: -0.999, size: 653, queued_as: 96547456D3, 1084 ms
Oct 12 15:27:33 postfix-mail-server postfix/amavis/smtp[7971]: 5B2FA45699: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.3, delays=0.17/0.01/0/1.1, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 96547456D3)
Oct 12 15:27:33 postfix-mail-server postfix/qmgr[4565]: 5B2FA45699: removed
Oct 12 15:27:34 postfix-mail-server postfix/smtp[7976]: 96547456D3: to=<[email protected]>, relay=smtp.sendgrid.net[ipAddress]:2525, delay=0.39, delays=0.01/0.01/0.32/0.05, dsn=5.0.0, status=bounced (host smtp.sendgrid.net[ipAddress] said: 550 The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved.
主配置文件
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
smtpd_tls_cert_file=/etc/letsencrypt/live/ourDomain.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/ourDomain.com/privkey.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = ourDomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
relayhost = [smtp.sendgrid.net]:2525
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
header_size_limit = 4096000
smtp_sasl_security_options = noanonymous
smtputf8_enable = no
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/sql/virtual_mailbox_maps.cf,proxy:mysql:/etc/postfix/sql/virtual_alias_domain_mailbox_maps.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/sql/virtual_alias_maps.cf,proxy:mysql:/etc/postfix/sql/virtual_alias_domain_maps.cf,proxy:mysql:/etc/postfix/sql/virtual_alias_domain_catchall_maps.cf
virtual_mailbox_base = /var/vmail
virtual_minimum_uid = 2000
virtual_uid_maps = static:2000
virtual_gid_maps = static:2000
smtpd_milters = unix:/var/run/rspamd/milter.sock
milter_default_action = accept
content_filter = smtp-amavis:[127.0.0.1]:10024
smtpd_proxy_options = speed_adjust
主控文件
smtp inet n - y - - smtpd
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o content_filter=smtp-amavis:[127.0.0.1]:10026
smtps inet n - y - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o content_filter=smtp-amavis:[127.0.0.1]:10026
pickup unix n - y 60 1 pickup
cleanup unix n - y - 0 cleanup
qmgr unix n - n 300 1 qmgr
tlsmgr unix - - y 1000? 1 tlsmgr
rewrite unix - - y - - trivial-rewrite
bounce unix - - y - 0 bounce
defer unix - - y - 0 bounce
trace unix - - y - 0 bounce
verify unix - - y - 1 verify
flush unix n - y 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - y - - smtp
relay unix - - y - - smtp
-o syslog_name=postfix/$service_name
showq unix n - y - - showq
error unix - - y - - error
retry unix - - y - - error
discard unix - - y - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - y - - lmtp
anvil unix - - y - 1 anvil
scache unix - - y - 1 scache
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
smtp-amavis unix - - n - 4 smtp
-o syslog_name=postfix/amavis
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
-o smtp_tls_security_level=none
127.0.0.1:10025 inet n - n - - smtpd
-o syslog_name=postfix/10025
-o content_filter=
-o mynetworks_style=host
-o mynetworks=127.0.0.0/8
-o local_recipient_maps=
-o relay_recipient_maps=
-o strict_rfc821_envelopes=yes
-o smtp_tls_security_level=none
-o smtpd_tls_security_level=none
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_end_of_data_restrictions=
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings
答案1
检查是否config.local.php
$CONF['admin_email']
设置了。postfixadmin 使用它作为发件人,不幸的是,如果没有设置,就无法回退到 postmaster 等。
根据 RFC 5322 第 3.6 节,发件人是两个必需的标题之一,因此这些邮件被正确拒绝。