设置 CentOS 电子邮件服务器时遇到问题

设置 CentOS 电子邮件服务器时遇到问题

我在 CentOS 上设置邮件服务器时遇到了一些问题,截至目前,根本没有发送任何邮件,而且我也不太清楚原因,我尝试了一些指南,但似乎都没有解释任何问题,我不知道是否可能在某个地方输入了错误的内容。

我不完全确定我需要在这里发布什么配置,但如果你需要它们,只需询问:)

我使用的服务器是我家中托管的 CentOS 服务器,我们已将其设置为从路由器接收从端口 1 到 65556 的端口转发,因此所有端口均可供服务器使用,在这方面应该不会有问题。

这是本地用户错误日志:

/var/log/邮件日志:

Mar  2 18:03:12 localhost postfix/smtp[6113]: 4BE3A959E: to=<conner@******.com>, relay=mx1.ovh.net[213.186.33.29]:25, delay=62, delays=0.06/0.01/62/0.08, dsn=5.0.0, status=bounced (host mx1.ovh.net[213.186.33.29] said: 552 sorry, your envelope sender domain must exist (#5.7.1) (in reply to MAIL FROM command))
Mar  2 18:03:12 localhost postfix/smtp[6113]: 4BE3A959E: lost connection with mx1.ovh.net[213.186.33.29] while sending RCPT TO
Mar  2 18:03:12 localhost postfix/cleanup[6112]: 3036911153: message-id=<[email protected]>
Mar  2 18:03:12 localhost postfix/bounce[6114]: 4BE3A959E: sender non-delivery notification: 3036911153
Mar  2 18:03:12 localhost postfix/qmgr[8477]: 3036911153: from=<>, size=2799, nrcpt=1 (queue active)
Mar  2 18:03:12 localhost postfix/qmgr[8477]: 4BE3A959E: removed

postconf -n 输出:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

建议答案后的错误日志:

Mar  3 19:55:25 localhost sendmail[2711]: s23JtP5O002711: localhost.localdomain [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA
Mar  3 19:55:26 localhost sendmail[2712]: s23JtPJc002712: [email protected]... User unknown
Mar  3 19:55:26 localhost sendmail[2712]: s23JtPJc002712: [email protected], size=0, class=0, nrcpts=0, proto=SMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Mar  3 19:58:03 localhost sendmail[2756]: s23Jw3lq002756: localhost.localdomain [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA
Mar  3 19:58:04 localhost sendmail[2757]: s23Jw3dS002757: localhost.localdomain [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA
Mar  3 19:58:07 localhost sendmail[2759]: s23Jw7wq002759: localhost.localdomain [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA
Mar  3 19:58:08 localhost sendmail[2760]: s23Jw7kP002760: [email protected]... User unknown
Mar  3 19:58:08 localhost sendmail[2760]: s23Jw7kP002760: [email protected], size=0, class=0, nrcpts=0, proto=SMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Mar  3 19:58:56 localhost sendmail[2764]: s23Jws2r002764: cpc2-sgyl27-2-0-cust995.sgyl.cable.***********.net [82.41.183.228] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA
Mar  3 19:58:56 localhost sendmail[2765]: s23Jwutl002765: cpc2-sgyl27-2-0-cust995.sgyl.cable.***********.net [82.41.183.228] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA
Mar  3 19:59:12 localhost sendmail[2767]: s23JxBSD002767: cpc2-sgyl27-2-0-cust995.sgyl.cable.***********.net [82.41.183.228] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA
Mar  3 19:59:14 localhost sendmail[2768]: s23JxCnO002768: conner@***********.com... User unknown
Mar  3 19:59:14 localhost sendmail[2768]: s23JxCnO002768: [email protected], size=0, class=0, nrcpts=0, proto=SMTP, daemon=MTA, relay=cpc2-sgyl27-2-0-cust995.sgyl.cable.virginm.net [82.41.183.228]

新的 Postconf -n 设置:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = **********.co.uk
myhostname = mail.***********.co.uk
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

答案1

status=bounced (host mx1.ovh.net[213.186.33.29] said: 552 sorry, your envelope sender domain must exist (#5.7.1) (in reply to MAIL FROM command))

从日志中我可以看到,您尝试从不存在的域发送邮件。我假设您使用的是 localhost 或 localhost.localdomain。您应该改用 fqdn

将以下行添加到 main.cf 并重新启动 postfix

myhostname = mail.example.net
mydomain = example.net
myorigin = $mydomain

PS 您应该用您的真实域名替换 example.net

相关内容