Report this

What is the reason for this report?

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

Posted on April 6, 2018

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 :')



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!

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.

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;

This comment has been deleted

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.