How to Stop Website Emails From Being Sent to Spam

  • Thread starter CraigHardy
  • Start date


May 11, 2021
Reaction Score
  • #1
I was up against this problem a few days ago. I set up four new discussion forums on different domains and after I tested each one for their email functionality, I realized that each and every domain was sending the test emails straight to spam. I searched for the answer all across the web and even on the software vendor’s website, without a concrete answer. I finally figured out what to do to solve this issue and I thought I’d share it with you. By the way, I’m using Cloudflare in conjunction with these domains, so I believe the email runs through that before it gets sent out. I’m no server expert, so please forgive my ignorance on this topic. Also, if you have anything to add or any corrections to what I’m about to suggest, please feel free to add to this in subsequent posts.

The entire thing has to do with DKIM and SPF records. It’s basically email “authentication” to help prevent spam messages from being sent out by including verifiable data inside of each message that can be detected and traced back to its originating source. If you connect everything the way it should be, the quantity of messages that go to the spam folder in your user’s email accounts should drop dramatically. I’ve been testing this for about a week now with many emails being sent out to a number of accounts and not one has failed. I guess the spam filters in Yahoo, Gmail and the rest really appreciate emails that are authenticated.

DKIM prevents incoming spam messages. It keeps any message from being modified and it shows that the originating source of the email is accurate.

SPF tethers specific servers and IP addresses with emails that are sent from them. You essentially tell the email providers (Gmail, Yahoo) that the email they are receiving is legitimate because the domain has been verified. This prevents outgoing spam messages.

Okay, here’s how to set this all up. My system is running WHM and cPanel and again, I’m using Cloudflare.

I logged into WHM, found the list of accounts and clicked on the CP link for the domain I was interested in protecting. Then, once in cPanel, I clicked the Authentication link inside of the Email section.

Once inside, I located the information I was interested in. It’s listed on the page in plain view.

Next, I logged into my Cloudflare account and visited the DNS page for the same domain. I then followed these instructions for adding the information:


To add a TXT DKIM record:

1. Log in to the Cloudflare dashboard.

2. Ensure the website you want to update is selected.

3. Select the DNS app.

4. Under DNS Records, complete the fields for your TXT record, including your DKIM values record.

5. Click Add Record.

More on this topic here.


1. Log in to your Cloudflare account.

2. From the dropdown on the top left, select your domain.

3. Click the DNS app at the top of the page.

4. Choose TXT. The SPF format has been deprecated due to the DNS RFC.

5. Add your SPF record string under the value section and click Add.

More on this topic here.

To make things simple, I’ll tell you that this process just copies the information from the page in cPanel and pastes it into the page in Cloudflare. Once the two are connected, your server should become a trusted asset and the email providers will no longer view it as a spam machine.