Question

Why Postfix Ubuntu 20.04 Is not sending emails

Posted January 27, 2021 1.1k views
PHPEmailUbuntu 20.04

Hello
iam having a issue with postfix on ubuntu (with plesk installed)

the postfix is not sending any mail
iam not getting any error on php script
i use my contact form on my website, the contact form says its succesfully sent, i check my email, i dont see anything

can you help me guys

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
3 answers

Hi @easyfilezboy,

Firstly, I’ll recommend using port 465 for sending out messages rather than 25. Port 25 is considered an unsecured port and more often than not providers block emails from it.

Another possibility is the IP of the Droplet is considered as a threat due to some reason.

I do believe messages are being sent but just are always deferred by the host. I’ll recommend using an e-mail checker to see what score your E-mails rank up to. The link is here - https://www.mail-tester.com/. The way it works is you send a message to the given e-mail account and check the score of your message. It will provide you with a scale from 1 to 10 and notify you about any issues you might need to fix.

Try it out and see if after making a 10/10 score on the tester the messages will still be marked as spam.

One other thing, you know content does matter and it’s possibly Gmail are marking your messages based on it.

Additionally, if you do wish to continue using port 25 or port 465, make sure to actually allow those ports to have outgoing traffic in your Firewall.

If you are using UFW

sudo ufw allow 25/tcp
sudo ufw allow 465/tcp
sudo ufw reload

If you are using plain IPtables use:

iptables -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -p tcp --dport 465 -j ACCEPT

Now to allow access to incoming connections:

Allow All Incoming SMTP
To allow your server to respond to SMTP connections, port 25, run these commands:

sudo iptables -A INPUT -p tcp --dport 25 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 25 -m conntrack --ctstate ESTABLISHED -j ACCEPT

The second command, which allows the outgoing traffic of established SMTP connections, is only necessary if the OUTPUT policy is not set to ACCEPT.

Regards,
KDSys

Hi there,

It is possible that port 25 is closed for new accounts, have you tried using port 465 or 587 instead?

Regards,
Bobby

Hello there,

As Bobby already mentioned, port 25 may be closed for new accounts. I will also recommend you to try with alternative ports like 465 or 587.

To expand more on blocking port 25 for new accounts, this is something we have been doing to reduce spam on our network. Please do not think that we are accusing you of sending spam, it is more that we simply cannot accurately determine who is going to send it.

Stopping spam is a constant fight, so we have implemented some restrictions on newer accounts. To qualify for the ability to send out an email, we do require accounts to wait 60 days before we can look into removing the restriction. Once your account has reached 60 days of stable use, please do reach back out to us so we can look into this for you.

Hope that helps!
Regards,
Alex