Question

Wordpress not sending emails on a certain site (Apache Virtual Hosts) Ubuntu 16.04

I have three Wordpress sites on this droplet. The first two send emails fine. The third one, which I have set up recently, will not send emails - not from contact us forms, nor from trying to change the admin email. The forms etc appear to work fine but no email ever shows up.

I am using Migadu. Sending emails manually from this domain is fine. So I don’t think it’s the DNS.

Nothing shows up in /var/log/mail.log. In fact this file has not been edited since 2018. Same for mail.log.1

I tried using WP Mail SMTP plugin and pointing it at Migadu SMTP. This doesn’t work, it says “There was a problem while sending the test email” when testing.

I never had this problem when I set up the second Virtual Host site. What could be causing this?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @umpire,

You’ve been on the right track, the best way to make sure your e-mails will be received is using a plugin for SMTP, like in your case WP MAIL SMTP.

Yes, you mentioned you received the error “There was a problem while sending the test email” however this I believe is because of the port you’ve used to be set as closed. So, I believe you’ve either used port 465 or 587 to send the e-mails, correct? Either of these should be allowed for outgoing connections in order for you to be able to send out e-mails using Migadu.

You can allow either port with the following two commands

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

Or for port 587

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

Regards, KFSys