bolbona
By:
bolbona

WordPress mail going to spam folder after moving to Digital Ocean from Godaddy

May 27, 2017 383 views
PHP Apache Email DigitalOcean WordPress Ubuntu 16.04

WordPress site mails going to spam folder after moving from GoDaddy shared hosting to Digital Ocean (still using CloudFlare).
Currently I'm hosting 3 websites in 1 droplet...
But all the PHP mail are sent to spam folder...

Here is my cloudflare DNS settings of my primary website.

My domain provider is BigRock.in and those MX settings are for BigRock email that I access from webmail.mywebsite.com

When I was in GoDaddy shared hosting, it was working as expected... but not now...

How fix this? so that emails sent from any one my domains of the droplet do not go to spam folder..

Thank you...

1 Answer

@bolbona

GoDaddy uses cPanel last I recall, so their servers have a functional mail server already installed and setup. When an e-mail is sent from your domain on their servers, it can be validated.

When you send e-mail from your Droplet that may not have a functional e-mail server setup to validate outgoing mail, it lands in junk/spam as the receiving server can't verify that it's being sent from the intended sender/domain(s)/host.

...

WordPress, without a plugin, sends mail using PHP's mail() function which doesn't validate what's being sent, or who's sending it. It sends what you tell it, when you tell it.

..

There's two ways to fix that. The first would be to setup a working mail server on your Droplet and go through the process of setting up Postfix, SPF, DKIM, DMARC, and PTR (Reverse DNS).

If you go this route, this will get you started, but it's not all-inclusive and there's still much of what I noted above that needs to be installed and configured beyond what this guide details:

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-16-04

The second and, in my opinion, better method would be to use a transactional e-mail provider such as SparkPost, SendGrid, or Mailgun (all of which have WordPress plugins to integrate with their API).

https://sparkpost.com
https://wordpress.org/plugins/sparkpost/

https://sendgrid.com
https://wordpress.org/plugins/sendgrid-email-delivery-simplified/

https://mailgun.com
https://wordpress.org/plugins/mailgun/

Using the above, you're not managing a mail server on your own (which can be a major pain, if you're not sure what you're doing) and SparkPost allows you to send up to 100,000 e-mails per month, which should fit most users needs.

Postfix is a popular open-source Mail Transfer Agent (MTA) that can be used to route and deliver email on a Linux system. It is estimated that around 25% of public mail servers on the internet run Postfix. In this guide, we'll teach you how to get up and running quickly...
  • Thank you for your answer!
    I've already installed Postfix and it's working... and I want to send mail from non WordPress sites too that uses PHP mail function... Please tell me how to configure my server in such a way, so that it works for all of my sites...

Have another answer? Share your knowledge.