Sendmail / postfix邮件不从本地Mac OS X(Mountain Lion)发送 [英] Sendmail/postfix mail not sending from local Mac OS X (Mountain Lion)

查看:220
本文介绍了Sendmail / postfix邮件不从本地Mac OS X(Mountain Lion)发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



即使直接测试:



date | mail -s test myEmail@gmail.com



即使是垃圾邮件,邮件也不会到达。在日志中,我联系google / gmail看到大量的运行超时错误:

  3月17日10: 57:13 imac.helion3.com postfix / postfix-script [10924]:启动Postfix邮件系统
Mar 17 10:57:13 imac.helion3.com postfix / master [10925]:守护进程 - 版本2.9.4配置/ etc / postfix
Mar 17 10:57:13 imac.helion3.com postfix / qmgr [10933]:012175629F9F:from =& daemon@localhost.localhost> size = 352,nrcpt = 1(队列活动)
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]:连接到gmail-smtp-in.l.google.com [74.125.25.27]:25:操作超时
3月17日10:57:46 imac.helion3.com postfix / smtp [10951]:连接到gmail-smtp-in.l.google.com [74.125.25.26]:25:操作超时
3月17日10:58 :13 imac.helion3.com postfix / smtp [10937]:连接到alt1.gmail-smtp-in.l.google.com [74.125.193.27]:25:操作超时
3月17日10:58: 16 imac.helion3.com postfix / smtp [10951]:连接到alt1.gmail-smtp-in.l.google.com [74.125.193.27]:25:操作超时
3月17日10:58:43 imac.helion3.com postfix / smtp [10937]:连接到alt2.gmail-smtp-in.l.google.com [74.125.196.26]:25:操作超时
3月17日10:58:46 imac .helion3.com postfix / smtp [10951]:连接到alt2.gmail-smtp-in.l.google.com [74.125.196.27]:25:操作超时
3月17日10:5 9:13 imac.helion3.com postfix / smtp [10937]:连接到alt3.gmail-smtp-in.l.google.com [173.194.76.27]:25:操作超时
3月17日10:59 :16 imac.helion3.com postfix / smtp [10951]:连接到alt3.gmail-smtp-in.l.google.com [74.125.29.26]:25:操作超时
3月17日10:59: 43 imac.helion3.com postfix / smtp [10937]:连接到alt4.gmail-smtp-in.l.google.com [74.125.131.27]:25:操作超时
3月17日10:59:43 imac.helion3.com postfix / smtp [10937]:012175629F9F:to =< myEmail@gmail.com> relay = none,delay = 689,延迟= 538 / 0.01 / 150/0,dsn = 4.4.1,状态=延迟(连接到alt4.gmail-smtp-in.l.google.com [74.125.131.27]:25:操作超时)
Mar 17 10:59:46 imac.helion3.com postfix / smtp [ 10951]:连接到alt4.gmail-smtp-in.l.google.com [173.194.75.27]:25:操作超时

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

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

我已经配置了postfix在日志中看到ipv6错误后使用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&& echoTCP端口25打开||回声TCP端口25关闭

这应该指示端口25是否在您的机器上打开。如果端口关闭,你显然需要打开它。



另一个有用的命令是:

  sudo lsof -i -P | grep -ilisten

哪些将指示所有打开的端口和连接当前处于活动状态。 p>

由于您没有提供任何有关您的配置信息的信息,我只能推测您的中继主机设置为什么。如果是谷歌,请尝试将端口设置为 587

  relayhost = smtp.gmail.com:587 

默认情况下,ISP的阻止端口25通常由垃圾邮件发送者常用。


编辑:确定在这种情况下,两件事必须花费
代价:


  1. 后缀邮件服务器正在使用动态ip

  2. 邮件服务器托管一个阻止端口25的ISP >

修复程序是使用中继服务器,其中包括更新后缀
main.cf以及添加中继主机信息,身份验证
标志。默认提交端口已更改为使用587绕过isp块。



I'm trying to get sendmail/postfix working properly on my iMac (10.9.2). I have a php web application I'm trying to test locally and it needs to send mail.

Even when testing this directly:

date | mail -s test myEmail@gmail.com

The mail never arrives, even as spam. In the logs, I'm seeing tons of "operation timed out" errors for contacting 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

I've run through the recommended postfix perms commands:

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

I've configured postfix to use ipv4 after seeing ipv6 errors in the logs. This is for testing something locally anyway so I don't mind.

I've configured php to use:

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

Even though my current tests don't involve php.

解决方案

It appears port 25 is blocked (either from your ISP or possibly on your end):

google.com[74.125.131.27]:25: Operation timed out

Open Terminal and paste:

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

This should indicate whether or not port 25 is opened on your machine. If the port is closed you'll obviously need to open it.

Another useful command is:

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

Which will indicate all of the open ports and connections currently active.

Since you haven't provided any info about your configuration itself I can only speculate what your relayhost is set as. If it's google, then try setting the port to 587:

relayhost = smtp.gmail.com:587

Often ISP's block port 25 by default since it's commonly used by spammers.

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.

这篇关于Sendmail / postfix邮件不从本地Mac OS X(Mountain Lion)发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆