WordPress sends all mail from root@localhost using wp_mail()

I have a Digital Ocean droplet that was configured using the Laravel Forge build scripts.

It comes with LEMP stack setup.

All my emails from a WordPress site I have set up are sending out via root@localhost and consequently been rejected.

Sending via SMTP or the SparkPost API doesnt help nor does changing the email sender in functions.php or using a plugin to change it help.

FML I’ve been stuck on this for a few days already.

Any ideas?


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.


Hmm I dont think that will work as I’ve implemented an alternate but similar plugin and added the necessary filters to functions.php to over ride the sender and it still doesnt work.


I’d recommend checking this plugin out:

That plugin should help you to get around the default name and e-mail used by WordPress without having to actually implement the code yourself.


I tried using WP Mail SMTP and using SparkPost which is what I’m using but nothing seems to stop WordPress from using root@locahost as the sender address.

Because the sender address fails validation the mail gets rejected by wp_mail()


Are you using a WordPress plugin to integrate with a third-party solution, such as WP Mail SMTP?

By default, WordPress relies on PHP’s built-in mail() function which, without a valid and working mail server, will ultimately result in e-mails sent from WordPress landing in the SPAM/Junk folder. You can get around this by using a plugin, such as the one referenced about, that will allow you to integrate with third-party solutions such as Google Gmail, Mailgun, SendGrid, and others.

I’ve used this plugin in the past and it’s always worked without any issues, so long as the connection details that are provided to it are correct.