Ubuntu 16 + Wordpress + WP Mail SMTP + PHP Applications on server can't connect to SendGrid or Other SMTP Relay

April 6, 2018 468 views
Apache Email WordPress PHP Ubuntu 16.04

Hi,
I'm new to server management. I've installed LAMP stack and setup Wordpress on main domain and a PHP script on sub domain... After it I want SendGrid SMTP to be used by Wordpress web and by script, I do it on Wordpress by WP Mail SMTP plugin and setup SendGrid API in it and click save when I go to check this out, I go to wordpress login page then forgot password and type my email in it and hit enter but it gives me error PHP mail() function is disabled on my server! After it I open WP Mail SMTP and change the settings from SendGrid to None (System Defaults) and click save, now i again go to check this by going to forgot password entered my email and press enter, Email send successfully! On my email I've received password reset email by root@localhost, Same error with other PHP script on which in script SMTP settings i put all SendGrid SMTP values and click save but it gives me "Connection Failed" error!
Please help me :')

2 Answers

You may need to install the sendmail or postfix package on your droplet in order for the PHP mail() function to be able to attempt to send via SMTP.

sudo apt-get update;
sudo apt-get install postfix;
  • @ryanpq Already tried but problem not solved :(

    • In that case I would recommend opening a ticket with our support team. We do block SMTP for a small number of new accounts based on an automated system. These blocks are done on an account level and not an individual droplet level so if you are able to send mail via SMTP on other droplets this is not likely the cause of the issue.

      We do block SMTP on ipv6 so you will need to make sure, if you're using ipv6 on your droplet that you have SMTP sending over ipv4.

Have another answer? Share your knowledge.