我在从 cyberpanel rainloop 发送电子邮件时遇到问题。我正在 mx 工具箱上测试,它显示
Status Ok SMTP Reverse DNS Mismatch OK - 170.64.156.12 resolves to mail.kacktus.com.au
Status Ok SMTP Valid Hostname OK - Reverse DNS is a valid Hostname
Status Ok SMTP Banner Check OK - Reverse DNS matches SMTP Banner
Status Ok SMTP TLS OK - Supports TLS.
Status Ok SMTP Connection Time 1.123 seconds - Good on Connection time
Status Ok SMTP Open Relay OK - Not an open relay.
Status Ok SMTP Transaction Time 2.368 seconds - Good on Transaction Time
Connecting to 170.64.156.12
220 mail.kacktus.com.au ESMTP Postfix [869 ms]
EHLO keeper-us-east-1d.mxtoolbox.com
250-mail.kacktus.com.au
250-PIPELINING
250-SIZE 30720000
250-ETRN
250-STARTTLS
250-AUTH PLAIN
250-AUTH=PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 CHUNKING [337 ms]
MAIL FROM:<[email protected]>
250 2.1.0 Ok [340 ms]
RCPT TO:<[email protected]>
554 5.7.1 <[email protected]>: Relay access denied [340 ms]
这是 postfix 配置:
myhostname = mail.kacktus.com.au
mynetworks = 170.64.156.12, 127.0.0.0/8
message_size_limit = 30720000
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_cano>
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
inet_interfaces = all
smtp_tls_security_level = may
disable_vrfy_command = yes
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept
tls_server_sni_maps = hash:/etc/postfix/vmail_ssl.map
我尝试了很长时间才找到解决方案,但还是没有找到。我正在使用带有 cyberpanel 的 digitalocean droplet。
答案1
错误消息准确地说明了它无法正常工作的原因。MX Toolbox 正在尝试使用您的服务器作为中继,但您的服务器不允许中继。
如果你想成为一个开放中继(你不应该想要),您可以将其添加0.0.0.0/0
到您的mynetworks
,但出于从 MX Toolbox 进行测试的目的,您可以暂时设置它。
前段时间,我制作了一个简单的 Ansible 角色来配置 Postfix 服务器,您可能会从中获得有用的信息:https://github.com/polatsinan/postfix_server
专门寻找templates/main.cf.j2
文件。