![Postfix、dovecot、squirrelmail 服务器可以发送但不能接收邮件](https://linux22.com/image/713364/Postfix%E3%80%81dovecot%E3%80%81squirrelmail%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%8F%AF%E4%BB%A5%E5%8F%91%E9%80%81%E4%BD%86%E4%B8%8D%E8%83%BD%E6%8E%A5%E6%94%B6%E9%82%AE%E4%BB%B6.png)
我已经使用本指南设置了一个邮件服务器:https://www.ostechnix.com/setup-mail-server-using-postfixdovecotsquirrelmail-in-centosrhelscientific-linux-6-3-step-by-step/
Webmail 允许在本地用户之间(即在本地计算机中)发送电子邮件,并向其他服务器(如 gmail)发送电子邮件。但它无法接收来自外界的电子邮件。以下是我在 /etc/postfix/main.cf 中的内容:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
compatibility_level = 2
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
home_mailbox = Maildir/
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
meta_directory = /etc/postfix
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = domain.com
myhostname = mail.domain.com
mynetworks = 192.168.0.0/24, 127.0.0.0/8, [::1]/128
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix/README_FILES
sample_directory = /usr/share/doc/postfix/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
shlib_directory = /usr/lib64/postfix
unknown_local_recipient_reject_code = 550
不过,我的域名和主机名是假的。另外,我们的 ISP 不应该阻止端口 25 上的任何入站 SMTP 连接,但与此同时我们必须仔细检查一下。请提供建议!
2017 年 11 月 14 日更新:再次启用了防火墙服务并打开了上述端口。现在尝试在 squirrelmail 上发送电子邮件时出现此错误:
Connection refused 111 Can't open SMTP stream.
请帮忙
答案1
该指令:
inet_interfaces = localhost
限制 Postfix 接收本地主机上的邮件。尝试将其设置为
inet_interfaces = all
实际上也接受来自互联网的传入连接。
(并且,不要像该配方中那样完全禁用防火墙,而是在防火墙中打开 TCP 端口 25(SMTP)、143(IMAP)和 80/443(HTTP/HTTPS)并保持启用状态。)