How can I ensure that emails generated by the server/Wordpress don't end up in spam?

I’m not trying to run my own mail server, so email for this domain is hosted elsewhere. But, of course, Wordpress needs to send email (woocommerce orders, password reset notifications, contact forms etc) from the domain. Human to human email is fine, but any emails from the website itself go directly to spam. I have mx records and an spf record that I got from the email host. I have edited the spf record with the addition of, (in addition to the original but I’m not sure that’s the correct domain with my setup?

It seems like maybe I need to install Postfix to properly send email from my own server. I’m prepared to follow this tutorial:

However, it seems like this tutorial is aimed at users who have one domain per droplet? I use the LAMP stack and have multiple virtual hosts. Is there different steps involved if I wanted to properly configure sending email from each domain I have associated with my droplet?

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.

Accepted Answer


The issue is that by default, WordPress uses PHP’s mail() function and nothing more. Mail sent using this function is inevitably going to end up in spam/junk due to the fact that there’s no authorization.

It’s simple to create a function that runs mail() through a loop and sends 10k-100k e-mails in a very short period of time complete with random messages and e-mails. Since there’s no authorization to an e-mail server, via SMTP or API, the mail comes through from whatever the hostname of the VPS or Droplet happens to be and gets flagged (as it should).

What I recommend using using a transactional e-mail provider, such as SparkPost. The service is free up to 100k e-mails per month, and it’s one that I recommend to most that I work with who need e-mail but don’t want to manage their own mail server.

There’s a WordPress plugin to help in connecting as well.

Of course, there are others: Mandrill, MailGun, and SendGrid, just to name a few.

Site Moderator
Site Moderator badge
July 8, 2021

Hello, all

You can make sure that your mailing list is fully opted-in and that you’re using SMTP authentication.

Also to test the mail score of your emails you can use a website like:

and then send a valid test - an exact email with a valid - subject, message body, full signatures and attachments.

Regards, Alex

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel