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

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.


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()