webserver no longer sending email to outside sources like gmail or hotmail

jrm213jrm213 used Ask the Experts™
We previously hosted our own email and have switched to a new hosted email system. When we were on our own email system our webserver was able to send mail without problem to wherever it needed. Since we switched we get the following in our mail log.

now we changed the smtp settings in php.ini and opened ports in the firewall to allow access to our hosted email server.

When I try to telnet to one of the ip's below on port 25 from the webserver, it times out.
When I try to telnet to one of the ip's below from my home on port 25 it connects.

I don't manage the servers, I manage the websites (which are no longer sending any type of email unless it is to one of our internal domains).

Is this more to do with the firewall? What needs to happen to allow these connections to go through? And why is the webserver trying to connect gmail/hotmail/yahoo etc if we have set up the smtp settings to use our hosted provider...

May 17 01:38:06 i007 postfix/error[3886]: CC0234C236: to=<xxx@gmail.com>, relay=none, delay=296083, delays=295933/150/0/0.01, dsn=4.4.1, status=deferred $
May 17 01:38:06 i007 postfix/smtp[3359]: connect to m.mx.mail.yahoo.com[]:25: Connection timed out
May 17 01:38:06 i007 postfix/smtp[3366]: connect to mailin-03.mx.aol.com[]:25: Connection timed out

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Check if firewall is blocking outgoing port 25, since internal connectivity said everything on your webserver is fine.



Hi Dennis,

Thanks for the quick reply. So port 25 outgoing needs to be open for any host is that correct, but it can deny all incoming on 25.

Ougoing port 25 only needs to be open from you mailserver out to any host.
It doesn't have to be open incoming unless you also receive mail on that server.
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

If this is not a firewall problem (on your local network), the issue may be due to being blacklisted; the response from the other servers is usually indicative of this.  You should be able to spot the problem in your mailserver's logs.

It would be very helpful to see the mail logs around the time when you attempted to send one of the emails.  There may be several files to look through (i.e. mail.log, mail.warn, mail.info, and mail.err).
I am not sure why but our server admin is unable to get the firewall to act as we need. They said they are allowing outbound 25 to anywhere in the firewall rule, but mail is still not sending. When we turn the firewall off mail sends. So we turned the firewall off and did a postfix flush and all the messages in the queue/deferred sent except for ones to AOL (had no clue AOL was still around, it kind of blows my mind...) The AOL server refused to talk...

So I changed all the code to use a smtp connection to our new email service, authenticating as a new user we set up. This way there is no problem, and we no longer have mail stuck in the postfix deferred folders.

I think if we could have got the firewall rules sorted then it would have worked, but we did this workaround instead, so I am going to award points as a split to all that answered.


We ended up using a workaround, but I think it was a firewall issue, though I have no way to confirm that.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial