我是邮件服务器的新手,我想我完全破坏了配置,我不知道如何解决这个混乱局面。据我所知,一切都“正常”,但我想我错过了一些重要的东西。
我用 SERVER1 和 SERVER2 替换了 IP,并用 MYDOMAIN 替换了域。
设置:
2 Hetzner 服务器:一个用于网站(SERVER1 - VPS),另一个用于邮件和其他内容(SERVER2 - Webhosting)网站需要使用 PHP 发送 smtp 邮件,这部分正在运行。但如果用户邮件[电子邮件保护],它将不会被交付,并且我收到错误:
status=bounced (host mail.MYDOMAIN.com[SERVER2] said: 550 Sender verify failed (in reply to MAIL FROM command))
status=bounced (host mail.MYDOMAIN.com[SERVER2] said: 550 Unroutable address (in reply to RCPT TO command))
我尝试了很多不同的东西和配置,但都不起作用。这就是现在的情况。
DNS:
$TTL 7200
@ IN SOA ns1.your-server.de. postmaster.your-server.de. (
2018033101 ; serial
86400 ; refresh
10800 ; retry
3600000 ; expire
86400 ) ; minimum
@ IN NS ns3.second-ns.de.
@ IN NS ns.second-ns.com.
@ IN NS ns1.your-server.de.
@ IN A SERVER1
entwickler IN A SERVER2
mail IN A SERVER2
www IN A SERVER1
autoconfig IN CNAME mail.your-server.de.
ftp IN CNAME www
imap IN CNAME mail
pop IN CNAME mail
relay IN CNAME mail
smtp IN CNAME mail
@ IN MX 10 mail
_autodiscover._tcp IN SRV 0 100 443 mail.your-server.de.
@ IN TXT "v=spf1 +a +mx ?all"
主机名 SERVER1:
hostname -> mail
hostname -f -> mail.MYDOMAIN.com
Postfix 配置:
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 = mail.MYDOMAIN.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = MYDOMAIN.com, localhost
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
我非常感谢你们能给我的任何建议和帮助。我正在努力学习,但邮件服务器真是个难题……
如果您需要更多信息,请告诉我。
更新:
在我改变出发地和目的地之后,错误变成了我之前已经遇到的错误:
status=bounced (unknown user: "USER")
以下是完整日志:
Apr 5 09:09:19 mail postfix/pickup[29043]: B30A82645F9: uid=33 from=<www-data>
Apr 5 09:09:19 mail postfix/cleanup[29052]: B30A82645F9: message-id=<[email protected]>
Apr 5 09:09:19 mail postfix/qmgr[29044]: B30A82645F9: from=<[email protected]>, size=426, nrcpt=1 (queue active)
Apr 5 09:09:19 mail postfix/local[29054]: B30A82645F9: to=<[email protected]>, relay=local, delay=0.04, delays=0.02/0/0/0.01, dsn=5.1.1, status=bounced (unknown user: "USER")
Apr 5 09:09:19 mail postfix/cleanup[29052]: BAA252645FC: message-id=<[email protected]>
Apr 5 09:09:19 mail postfix/bounce[29055]: B30A82645F9: sender non-delivery notification: BAA252645FC
Apr 5 09:09:19 mail postfix/qmgr[29044]: BAA252645FC: from=<>, size=2296, nrcpt=1 (queue active)
Apr 5 09:09:19 mail postfix/qmgr[29044]: B30A82645F9: removed
Apr 5 09:09:19 mail postfix/local[29054]: BAA252645FC: to=<[email protected]>, relay=local, delay=0.02, delays=0.01/0/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)
Apr 5 09:09:19 mail postfix/qmgr[29044]: BAA252645FC: removed
发送到 Gmail 等邮件仍然没有错误。我猜他仍然试图将邮件附加到本地主机,而不是将其传递给邮件服务器?
更新2:
我现在将 mydestination 更改为 localhost,因为这似乎是正确的?现在中继是邮件服务器,但出现了 2 个新错误:
Apr 5 10:18:45 mail postfix/pickup[29400]: 4BB7F264615: uid=33 from=<www-data>
Apr 5 10:18:45 mail postfix/cleanup[29425]: 4BB7F264615: message-id=<[email protected]>
Apr 5 10:18:45 mail postfix/qmgr[29401]: 4BB7F264615: from=<[email protected]>, size=426, nrcpt=1 (queue active)
Apr 5 10:18:48 mail postfix/smtp[29426]: 4BB7F264615: to=<[email protected]>, relay=mail.MYDOMAIN.com[SERVER2]:25, delay=3.1, delays=0.02/0/3.1/0, dsn=5.0.0, status=bounced (host mail.MYDOMAIN.com[SERVER2] said: 550-Verification failed for <[email protected]> 550-Unrouteable address 550 Sender verify failed (in reply to MAIL FROM command))
Apr 5 10:18:48 mail postfix/cleanup[29425]: 73183264624: message-id=<[email protected]>
Apr 5 10:18:48 mail postfix/bounce[29438]: 4BB7F264615: sender non-delivery notification: 73183264624
Apr 5 10:18:48 mail postfix/qmgr[29401]: 73183264624: from=<>, size=2611, nrcpt=1 (queue active)
Apr 5 10:18:48 mail postfix/qmgr[29401]: 4BB7F264615: removed
Apr 5 10:18:51 mail postfix/smtp[29426]: 73183264624: to=<[email protected]>, relay=mail.MYDOMAIN.com[SERVER2]:25, delay=3, delays=0.01/0/3/0.02, dsn=5.0.0, status=bounced (host mail.MYDOMAIN.com[SERVER2] said: 550 Unroutable address (in reply to RCPT TO command))
Apr 5 10:18:51 mail postfix/qmgr[29401]: 73183264624: removed
答案1
似乎您可能缺少一些设置,并且可能有一些设置不正确。您可以尝试这些设置
mydomain MYDOMAIN.com
myorigin $mydomain
mydestination = $myhostname localhost.$mydomain localhost $mydomain
您已mynetworks
为 localhost 设置并允许其进入smtpd_relay_restrictions
。 SASL 是否设置正确并正常工作?