【问题标题】:Use postfix without third party relay service使用没有第三方中继服务的 postfix
【发布时间】:2020-03-22 09:46:17
【问题描述】:

我正在尝试使用 Postfix 作为仅发送 SMTP 服务器(不使用任何第三方中继服务)。由于许多云提供商阻止了端口 25,因此将后缀转发到端口 587。一切似乎都很好,但邮件没有到达目的地(即使是垃圾邮件)。

请帮助我解决问题。

我在后缀配置中所做的一些更改:-

/etc/postfix/main.cf

inet_interfaces = loopback-only
inet_protocols = ipv4

/etc/postfix/master.cf

587      inet  n       -       y       -       -       smtpd
submission inet n       -       y       -       -       smtp

命令输出:-

  • 后缀状态

    postfix/postfix-script: the Postfix mail system is running: PID: 21791

  • netstat -plutn | grep 587

    tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 21791/master

  • 587 端口在 ufw 防火墙和 AWS 安全组中都是开放的。

现在当我使用以下命令发送邮件时,它不起作用:-

echo "mail sent" | mail -s "Testing" example@gmail.com
  • /var/log/mail.log 的输出

    Mar 22 09:20:11 ip-172-31-93-212 postfix/smtp[21825]: 7E61A47CEE: to=<example@gmail.com>, orig_to=<root@ip-172-31-93-212.ec2.internal>, relay=none, delay=1884, delays=1733/0.01/150/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[172.217.218.26]:25: Connection timed out)
    Mar 22 09:20:11 ip-172-31-93-212 postfix/smtp[21826]: 313EB47D3D: to=<example@gmail.com>, relay=none, delay=613, delays=463/0.01/150/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[172.217.218.26]:25: Connection timed out)
    Mar 22 09:23:10 ip-172-31-93-212 postfix/smtp[21861]: connect to gmail-smtp-in.l.google.com[172.217.197.27]:25: Connection timed out
    Mar 22 09:23:24 ip-172-31-93-212 postfix/pickup[21801]: C17A847D45: uid=0 from=<root@ip-172-31-93-212.ec2.internal>
    Mar 22 09:23:24 ip-172-31-93-212 postfix/cleanup[21868]: C17A847D45: message-id=<20200322092324.C17A847D45@mail.your-domain.com>
    Mar 22 09:23:24 ip-172-31-93-212 postfix/qmgr[21802]: C17A847D45: from=<root@ip-172-31-93-212.ec2.internal>, size=367, nrcpt=1 (queue active)
    Mar 22 09:23:40 ip-172-31-93-212 postfix/smtp[21861]: connect to alt1.gmail-smtp-in.l.google.com[64.233.186.26]:25: Connection timed out
    Mar 22 09:23:54 ip-172-31-93-212 postfix/smtp[21869]: connect to gmail-smtp-in.l.google.com[172.217.197.27]:25: Connection timed out
    Mar 22 09:24:10 ip-172-31-93-212 postfix/smtp[21861]: connect to alt2.gmail-smtp-in.l.google.com[209.85.202.26]:25: Connection timed out
    Mar 22 09:24:24 ip-172-31-93-212 postfix/smtp[21869]: connect to alt1.gmail-smtp-in.l.google.com[64.233.186.26]:25: Connection timed out
    Mar 22 09:24:40 ip-172-31-93-212 postfix/smtp[21861]: connect to alt3.gmail-smtp-in.l.google.com[66.102.1.26]:25: Connection timed out
    Mar 22 09:24:54 ip-172-31-93-212 postfix/smtp[21869]: connect to alt2.gmail-smtp-in.l.google.com[209.85.202.26]:25: Connection timed out
    

感谢和问候

里士

【问题讨论】:

  • 将您的后缀服务器与域绑定并使用mxtoolbox.com 对其进行测试,以解决它们显示的任何问题。邮件服务器甚至不允许来自任意服务器的传入请求。

标签: wordpress nginx smtp ubuntu-18.04 postfix-mta


【解决方案1】:

让 MTA/postfix 监听端口 587 上的传入连接(来自用户)无法修复 传出 SMTP 连接的阻塞。

您是否收到 smtp 问候消息?在主机上使用下面的测试命令:

telnet gmail-smtp-in.l.google.com 25

这是检查是否是您的 SMTP/MTA 服务器故障的简单标准测试。

【讨论】:

  • 在端口 25 和 587 上都出现此错误===> telnet:无法连接到远程主机:网络无法访问。知道如何解决吗?
  • 让您的提供商取消阻止到端口 25 的传出连接使用可通过另一个端口(例如 587)访问的 SMTP 中继
猜你喜欢
  • 2018-09-04
  • 1970-01-01
  • 1970-01-01
  • 2011-09-15
  • 1970-01-01
  • 2020-08-26
  • 1970-01-01
  • 2019-03-15
  • 2014-10-09
相关资源
最近更新 更多