gpt4 book ai didi

macos - Sendmail/postfix 邮件无法从本地 Mac OS X (Mountain Lion) 发送

转载 作者:行者123 更新时间:2023-12-01 22:20:59 25 4
gpt4 key购买 nike

我正在尝试让 sendmail/postfix 在我的 iMac (10.9.2) 上正常工作。我有一个 php Web 应用程序,我正在尝试在本地测试,它需要发送邮件。

即使直接测试:

日期 |邮件 -s 测试 myEmail@gmail.com

邮件永远不会到达,即使是垃圾邮件。在日志中,我看到大量联系 google/gmail 的“操作超时”错误:

Mar 17 10:57:13 imac.helion3.com postfix/postfix-script[10924]: starting the Postfix mail system
Mar 17 10:57:13 imac.helion3.com postfix/master[10925]: daemon started -- version 2.9.4, configuration /etc/postfix
Mar 17 10:57:13 imac.helion3.com postfix/qmgr[10933]: 012175629F9F: from=<daemon@localhost.localhost>, size=352, nrcpt=1 (queue active)
Mar 17 10:57:16 imac.helion3.com postfix/pickup[10932]: 94BBF562A0B2: uid=501 from=<botskonet>
Mar 17 10:57:16 imac.helion3.com postfix/cleanup[10948]: 94BBF562A0B2: message-id=<20140317175716.94BBF562A0B2@localhost>
Mar 17 10:57:16 imac.helion3.com postfix/qmgr[10933]: 94BBF562A0B2: from=<botskonet@localhost.localhost>, size=310, nrcpt=1 (queue active)
Mar 17 10:57:43 imac.helion3.com postfix/smtp[10937]: connect to gmail-smtp-in.l.google.com[74.125.25.27]:25: Operation timed out
Mar 17 10:57:46 imac.helion3.com postfix/smtp[10951]: connect to gmail-smtp-in.l.google.com[74.125.25.26]:25: Operation timed out
Mar 17 10:58:13 imac.helion3.com postfix/smtp[10937]: connect to alt1.gmail-smtp-in.l.google.com[74.125.193.27]:25: Operation timed out
Mar 17 10:58:16 imac.helion3.com postfix/smtp[10951]: connect to alt1.gmail-smtp-in.l.google.com[74.125.193.27]:25: Operation timed out
Mar 17 10:58:43 imac.helion3.com postfix/smtp[10937]: connect to alt2.gmail-smtp-in.l.google.com[74.125.196.26]:25: Operation timed out
Mar 17 10:58:46 imac.helion3.com postfix/smtp[10951]: connect to alt2.gmail-smtp-in.l.google.com[74.125.196.27]:25: Operation timed out
Mar 17 10:59:13 imac.helion3.com postfix/smtp[10937]: connect to alt3.gmail-smtp-in.l.google.com[173.194.76.27]:25: Operation timed out
Mar 17 10:59:16 imac.helion3.com postfix/smtp[10951]: connect to alt3.gmail-smtp-in.l.google.com[74.125.29.26]:25: Operation timed out
Mar 17 10:59:43 imac.helion3.com postfix/smtp[10937]: connect to alt4.gmail-smtp-in.l.google.com[74.125.131.27]:25: Operation timed out
Mar 17 10:59:43 imac.helion3.com postfix/smtp[10937]: 012175629F9F: to=<myEmail@gmail.com>, relay=none, delay=689, delays=538/0.01/150/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[74.125.131.27]:25: Operation timed out)
Mar 17 10:59:46 imac.helion3.com postfix/smtp[10951]: connect to alt4.gmail-smtp-in.l.google.com[173.194.75.27]:25: Operation timed out

我已经运行了推荐的 postfix perms 命令:

sudo mkdir -p /Library/Server/Mail/Data/spool
sudo /usr/sbin/postfix set-permissions
sudo /usr/sbin/postfix start

在日志中看到 ipv6 错误后,我已将 postfix 配置为使用 ipv4。无论如何,这是为了在本地测试一些东西,所以我不介意。

我已经配置了要使用的 php:

sendmail_path=/usr/sbin/sendmail -t -i

尽管我当前的测试不涉及 php。

最佳答案

端口 25 似乎被阻止(无论是来自您的 ISP 还是可能在您这边):

google.com[74.125.131.27]:25:操作超时

打开终端并粘贴:

(echo >/dev/tcp/localhost/25) &>/dev/null && echo "TCP port 25 opened" || echo "TCP port 25 closed"

这应该表明您的计算机上是否打开了端口 25。如果端口关闭,您显然需要打开它。

另一个有用的命令是:

sudo lsof -i -P | grep -i "listen"

这将指示当前事件的所有开放端口和连接。

由于您没有提供有关您的配置本身的任何信息,我只能推测您的中继主机的设置。如果是 google,则尝试将端口设置为 587:

relayhost = smtp.gmail.com:587

ISP 通常会默认阻止端口 25,因为该端口常被垃圾邮件发送者使用。

EDIT: It was determined that two things had to be taken into consideration for this scenario:

  1. The postfix mailserver was using a dynamic ip
  2. The mailserver is hosted with an ISP that blocks port 25

The fix was to use a relay server, which involved updating the postfix main.cf with the additions of the relay host information and authentication flags. The default submission port was changed to use 587 to bypass the isp block.

关于macos - Sendmail/postfix 邮件无法从本地 Mac OS X (Mountain Lion) 发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22461966/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com