我的服务器两周前就出现这个新错误。
我没有触碰过代码或任何东西。
我通常通过 PHPMailer 发送邮件,但我注意到 Thunderbird 也不再起作用了。
我使用的是 Ubuntu 18.04 LTS。我执行了 apt get update/upgrade(+ 重启),但什么也没改变
通过“邮件”命令发送邮件可以正常工作:
echo "test" | mail -s "sujet" [email protected]
这是我的 postfix main.cf:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2
# 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_tls_cert_file=/etc/letsencrypt/live/mail.my-domain.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/mail.my-domain.com/fullchain.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
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
# myhostname = vps811910.openstacklocal
myhostname = mail.my-domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
# mydestination = $myhostname, vps811910, localhost.localdomain, localhost, mail.my-domain.com
mydestination = $myhostname, vps811910, localhost.localdomain, localhost, my-second-domain.com
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all
PHP 邮件程序:
答案1
请尝试看看这个邮政在 StackOverflow 上也许它也能为您解决问题。
然而,查看您的 PHP Mailer,我在这里看到一个奇怪的值:
$mail->Host = 'my-second-domain.com';
这应该包含您的 smtp 邮件主机,例如:
$mail->Host = “smtp.gmail.com”;