我有一个带有一些 VMS 的根服务器。 10.77.77.101 是邮件服务器,10.77.77.107 (vm07) 是运行 Wordpress 的 PHP Web 服务器。使用 Thunderbird 发送和接收邮件效果很好。通过 php 从 vm07 发送邮件工作正常,直到我启用 dovecot/sievepostfix/main.cf 中包含以下几行:
smtpd_sasl_type = dovecot
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_path = private/auth
当尝试从同一主机 (10.77.77.107) 上的另一个虚拟机中的 PHP 发送电子邮件时,我收到这些错误
connect from vm07[10.77.77.107]
postfix/smtpd[3691]: Anonymous TLS connection established from vm07[10.77.77.107]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
postfix/smtpd[3691]: warning: vm07[10.77.77.107]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
postfix/smtpd[3691]: disconnect from vm07[10.77.77.107] ehlo=2 starttls=1 auth=0/1 quit=1 commands=4/5
使用 Thunderbird 发送和接收邮件仍然可以正常工作,并且 sieve 可以成功地将垃圾邮件分类到“垃圾邮件”文件夹中。
这是我的 main.cf:
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
myhostname = example.de
mydomain = example.de
mydestination = localhost localhost.$mydomain
mynetworks = 127.0.0.0/8 138.201.16.163 10.77.77.1 10.77.77.0/24 [::1]/128 [2a01:4f8:241:1d02::]/64
message_size_limit = 90000000
mailbox_size_limit = 99999999
virtual_mailbox_limit = 90000000
alias_maps = $alias_database
virtual_mailbox_base = /var/kunden/mail/
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_mailbox_domains.cf
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_alias_maps.cf
virtual_uid_maps = static:2000
virtual_gid_maps = static:2000
smtpd_sasl_type = dovecot
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_relay_restrictions =
check_policy_service inet:127.0.0.1:10040
permit_mynetworks
permit_sasl_authenticated
reject_non_fqdn_recipient
reject_unknown_recipient_domain
reject_unauth_pipelining
reject_invalid_hostname
check_helo_access pcre:/etc/postfix/helo_checks.pcre
reject_rbl_client ix.dnsbl.manitu.net
reject_unauth_destination
smtpd_helo_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_non_fqdn_hostname,
reject_invalid_hostname,
reject_rhsbl_client rhsbl.sorbs.net,
reject_rhsbl_sender rhsbl.sorbs.net,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client sbl.spamhaus.org,
reject_unauth_pipelining
smtpd_sender_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination,
reject_rhsbl_client rhsbl.sorbs.net,
reject_rhsbl_sender rhsbl.sorbs.net,
reject_rbl_client sbl.spamhaus.org,
reject_rbl_client cbl.abuseat.org,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_pipelining
smtpd_tls_auth_only = yes
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtp_tls_key_file = /etc/ssl/selbst/example.de/privkey.pem
smtp_tls_cert_file = /etc/ssl/selbst/example.de/fullchain.pem
smtpd_tls_key_file = /etc/ssl/selbst/example.de/privkey.pem
smtpd_tls_cert_file = /etc/ssl/selbst/example.de/fullchain.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
smtpd_tls_mandatory_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA
smtpd_tls_dh1024_param_file = /etc/ssl/certs/dhparams.pem
smtpd_milters = inet:localhost:11332
non_smtpd_milters = inet:localhost:11332
milter_protocol = 6
milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen}
milter_default_action = accept
recipient_delimiter = +
我使用 ssmtp 发送电子邮件:
#/etc/ssmtp/ssmtp.conf
root=
mailhub=10.77.77.101
hostname=vm07.example.de
FromLineOverride=YES
从控制台发送邮件也可以正常工作:
echo "hello"|ssmtp [email protected]
使用该函数使用单个 PHP 脚本发送mail()
也可以正常工作,因此 WordPress 发送电子邮件的方式似乎有所不同。