Email wont send - all emails are now Connection timed out and stuck in queue

all emails are stuck in queue with error: Connection timed out
I checked the firewall and ports are open outbound

log file:
connect to zzz.mail.protection.outlook.com[xx.47.58.xxx]:25: Connection timed out

postfix/error[2193093]: C26801D00A1FF: to=tim@zzz, relay=none, delay=2267, delays=2267/0.02/0/0.01, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to zzz.mail.protection.outlook.com[104.47.70.110]:25: Connection timed out)

SYSTEM INFORMATION
OS type and version RHEL 9
Webmin version 2.021
Virtualmin version 7.5 pro
Related packages postfix

This looks like your hosting provider or network provider is blocking port 25. If not that, then Microsoft is blocking your IP. But, if it’s every mail server, then it’s your ISP/host.

I am the host, its my server and is located in my azure, I have opened up port 25/587 outbound to not block email/25/587

is there a way to change the outbound port for postfix away from 25?

how do others send email to a M365 email hosted domain?

Azure blocks port 25 outgoing by default (source).
Seems you can apply for an unblock, otherwise go with a relay service.

2 Likes

i did open outbound 25/587 in the azure side and on the RHEL server as well so its not ‘us’ blocking

Microsoft is the host.

And, all the major cloud providers block port 25, and you cannot unblock it in any easy way, AFAIK.

so is there way to change the email outgoing to sen over 587

No. 587 is the submission port, used by your clients to send mail to you. It is usually authenticated.

You have no control over the rest of the world, and to the rest of the world SMTP is port 25. If you don’t have port 25, you don’t have a mail server. You’ll have to use a relay. Some cloud providers allow incoming but not outgoing, in which case you could receive mail with this VM, but would need a relay to send, but I think all the majors block both in and out.

For my VMs and containers in Google Cloud or AWS, I usually use Mailgun as my relay. It’s cheap(ish), and works well. But, there are many other options: Amazon SES, Sendgrid, Mailjet, etc. Many to choose from.

i have one other virtulmin server running centos and it doesn’t have this issue?

so how does one send email from postfix/server? there are 100’s of emails stuck in the mail queue in postfix? can postfix use sendgrid?

I googled “Sendgrid Postfix”: Integrate SendGrid with Postfix - SendGrid Documentation | SendGrid | Twilio

And, it has nothing to do with CentOS. Your hosting provider is blocking port 25. No operating system can make port 25 open, if it is blocked. Only your hosting provider can do that. If Microsoft providers a method to request port 25 be opened, then you could do that. I don’t think most of the big cloud hosts will do that, though.

so i tried to telnet localhost 25 and it timed out on the cmd line?

i wonder if postfix is not allowing port 25?
i tried a few other domains on the box to telnet/send email via cmd line and all timed out?

were can I see if it’s configured correctly?

Postfix listens on port 25 because other servers need to know where to SEND to. I think source ports are randomly assigned and tracked by the network stack locally.

root@main:~# grep 25 /etc/services smtp 25/tcp mail

root@main:~# netstat -ap |grep smtp tcp 0 0 0.0.0.0:smtp 0.0.0.0:* LISTEN 1037666/smtpd

If Azure is blocking port 25 to prevent spam, there is NOTHING you can do about it if they don’t allow outbound or inbound port 25 requests. I did a quick search and it doesn’t look like Azure is a hosting platform as such. What I read says it is more of a development platform.

I’m not postfix expert but I doubt it would start if there was no listening port assigned. The programmers would probably flag that as “FATAL” and not let the program start unless corrected.

Well, this was easy and answered in post 4.

The Azure platform will block outbound SMTP connections on TCP port 25 for deployed VMs. This is to ensure better security for Microsoft partners and customers, protect Microsoft’s Azure platform, and conform to industry standards.

If you’re using a non-enterprise subscription type, we encourage you to use an authenticated SMTP relay service, as outlined earlier in this article.

easy tool to see if it a firewall issue

Also see:

1 Like

How can I change postfix to send on port 587 by default and not 25?
So eMaill email runs over 587

Joe sent a link on how to do over that port as a relay. If its not a relay host, NO. Server to server mail does not work on that port, only port 25.

I already answered your question about port 587. Email wont send - all emails are now Connection timed out and stuck in queue - #8 by Joe

To fix this problem use ZOHO my email server was working and then one day my ISP closed up a hole I was using to send email via their email server even though they were blocking the port so to speak their mail server was allowing me to relay mail. They were not even aware that they closed it it took a bit to get down to the bottom of things because I was technically relaying through their server and direct sends were not supposed to work which they did not but all in all not a lot I could do about their new policies other than find another ISP. But truth be told I came across a website after a bit of searching that provides a free email that will integrate with your domain URL that website being ZOHO so you just select an email with aliases youremails@yourdomain.whatever and you can interface with that. And it all works out pretty clean actually a great website and service obviously for them to offer this for free I believe they need our support as well so please do purchase a service or support their work if you can support it and keep it free for those of us that need it.

Hope this helps interface with ZOHO and your good to go. Your options are limited you can pay Gmail a crap ton for the same service that ZOHO offers for free if you prefer. Its all up to you really personally I can’t thank these guys enough I have a business and I would have considered closing down cause my business was far to small to justify costs of email and hosting etc
 Now I host and use ZOHO and can do so and keep my business open if I ever make it big enough these guys are going to get a good donation!

Maybe better yet I wonder if somehow Virtualmin could work with ZOHO to some how use their services integrated into their software somehow that would be rather cool.