电子邮件未发送到以 domainname.co 作为域名的电子邮件地址。
我在 Ubuntu 系统中有三个用户,即 root、ubuntu 和域名。
以下是日志(tail /var/log/mail.log -n 20)
Feb 19 04:36:56 server postfix/pickup[22963]: 521A0106D3A: uid=1003 from=<domainname>
Feb 19 04:36:56 server postfix/cleanup[26043]: 521A0106D3A: message-id=<[email protected]>
Feb 19 04:36:56 server postfix/qmgr[14300]: 521A0106D3A: from=<[email protected]>, size=357, nrcpt=1 (queue active)
Feb 19 04:36:58 server postfix/smtp[26045]: 521A0106D3A: to=<[email protected]>, relay=in.hes.trendmicro.com[54.219.191.20]:25, delay=1.9, delays=0.01/0.01/1.6/0.21, dsn=5.7.1, status=bounced (host in.hedmicro.com[54.219.191.20] said: 550 5.7.1 <[email protected]>: Recipient address rejected: ERS-DUL. (in reply to RCPT TO command))
Feb 19 04:36:58 server postfix/cleanup[26043]: 732DD106D41: message-id=<[email protected]>
Feb 19 04:36:58 server postfix/bounce[26046]: 521A0106D3A: sender non-delivery notification: 732DD106D41
Feb 19 04:36:58 server postfix/qmgr[14300]: 732DD106D41: from=<>, size=2368, nrcpt=1 (queue active)
Feb 19 04:36:58 server postfix/qmgr[14300]: 521A0106D3A: removed
Feb 19 04:36:59 server postfix/smtp[26045]: 732DD106D41: to=<[email protected]>, relay=in.hes.trendmicro.com[54.219.191.21]:25, delay=1.5, delays=0/0/1.3/0.21, dsn=5.7.1, status=bounced (host in.hes.trendmicro.com[54.219.191.21] said: 550 5.7.1 <[email protected]>: Recipient address rejected: ERS-DUL. (in reply to RCPT TO command))
Feb 19 04:37:00 server postfix/qmgr[14300]: 732DD106D41: removed
/etc/postfix/main.cf的内容
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
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_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = server.domainname.co
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#myorigin = /etc/mailname
myorigin = $mydomain
mydestination = $myhostname, server, localhost.domainname.co, localhost
#smtp_generic_maps = texthash:/etc/postfix/generic
relayhost =
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
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtp_tls_security_level = may
allow_percent_hack = no
我正在用下面的脚本检查这个。
$sender = '[email protected]';
$recipient = '[email protected]';
$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;
if (mail($recipient, $subject, $message, $headers)) {
echo "Message accepted";
} else {
echo "Error: Message not accepted";
}
更新:当前的答案将无济于事,因为在 main.cf 文件中的一些配置更改后错误代码发生了变化。