Sendmail / postfix mail is not sent from the local Mac OS X (Mountain Lion)

I am trying to work correctly with sendmail / postfix on my iMac (10.9.2). I have a php web application that I am trying to check locally and needs to send mail to it.

Even with direct testing:

date | mail -s test myEmail@gmail.com

Mail never arrives, even as spam. In the logs, I see tons of "startup operations" errors for communicating with 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 skipped 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 configured postfix to use ipv4 after looking at ipv6 errors in logs. This is for testing something locally, so I don't mind.

I configured php to use:

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

Although my current tests are not php related.

+8
email macos
source share
1 answer

It seems that port 25 is blocked (either by your ISP, or perhaps at 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 port 25 is open or not on your computer. If the port is closed, you obviously need to open it.

Another useful command:

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

All open ports and connections that are currently active will be displayed.

Since you did not provide any information about your configuration, I can only assume that your repeater is set to. If it is google, try setting the port to 587 :

 relayhost = smtp.gmail.com:587 

Often ISP port 25 is the default because it is commonly used by spammers.

EDIT: It was found that consideration of this scenario was needed:

  • Postfix mailserver used dynamic ip
  • The mail server is hosted with an ISP that blocks port 25

Fixed the use of a relay server, which included updating the postfix main.cf with the addition of information and authentication of the relay flags. The default send port has been changed to use 587 to bypass the isp block.

+9
source share

All Articles