Question

How to set up nginx server to allow WP send emails through gmail.com

when I use any Gmail account to WP admin mail I’m not received confirmation mail, How to set up an Nginx server to allow WP to send emails through gmail.com

Subscribe
Share

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

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.

Hello there,

What I could suggest here is using an SMTP plugin for your WordPress site.

That way you will be able to specify an SMTP server with authentication which your emails would be going through. You could for example use Gmail’s SMTP settings. This would drastically increase the delivery rate of your emails as well compared to using plain PHP mail.

I’ve been using this plugin for a while now and it works very well: Easy WP SMTP

https://www.digitalocean.com/community/tutorials/how-to-get-wordpress-email-notifications-on-a-digitalocean-droplet

Hope that this helps! Regards, Alex

Hi @melshity,

By default, WordPress uses the PHP mail function to send out email notifications. However, this function doesn’t work as expected due to a number of reasons.

Most WordPress hosting companies restrict usage of this function to prevent abuse and spam.

Spam filters on popular email service providers check incoming emails to monitor if they are sent from authentic mail servers. Default WordPress emails fail this check and sometimes may not even make it to the spam folder.

SMTP (Simple Mail Transfer Protocol) is the industry standard for sending emails. Unlike the PHP mail function, SMTP uses proper authentication, which increases email deliverability.

You can further check this plugin and how to configure it from this WordPress video:

https://www.youtube.com/watch?v=5YiW4mnn4tE

Additionally, you’ll need to allow outgoing ports 465 and 587. You can do it like so :

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

and

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