Email Authentication on Shared Hosting Prevent Spam with SPF, DKIM and DMARC

Email Authentication on Shared Hosting: Prevent Spam with SPF, DKIM and DMARC

Email Authentication on Shared Hosting: Prevent Spam with SPF, DKIM and DMARC 1024 585 Jesandy

Email authentication is an important part to make sure that the emails you send are trusted and not flagged as spam, whether you want to use for email marketing, for website system, notification, etc.

The way to do email authentication is using SPF, DKIM, and DMARC, this process basically like validate your email that is not “any email” and mark as appropriate in term of policy.

Before we begin, I collect ChatGPT: The Best Prompt for Starting Your Business or Project that might help you on setting up the plan

I share how to do it step by step process using CPANEL on Shared Hosting: both SPF and DKIM, DMARC is optional you may or not doing it, also I share how to setup SMTP which are important for reliable delivery.

1. Set Up Domain Authentication on Shared Hosting

1.1 SPF Record Setup (Sender Policy Framework)

SPF (Sender Policy Framework) records let you to specify which mail servers are permitted to send emails on behalf of your domain. This is the variable helps reduce chances of your emails being labeled as spam.

Step-by-Step Setup:
  • Access your hosting provider’s cPanel.
  • Find the Zone Editor within the Domains section.
  • Choose your domain (e.g., mydomain.com) and hit Manage.
  • Click Add Record, then select TXT Record.
  • Input the following:
  • Name: @ (or leave it blank).
  • TXT Data: v=spf1 a mx include: ~all (Replace with your actual provider, e.g., Gmail, Zoho).
  • Save the changes and wait for DNS propagation, which can take up to 48 hours.

1.2 DKIM Setup (DomainKeys Identified Mail)

DKIM adds a digital signature to your emails, which proves that they come from your domain and are not modified during transit. This also will boost email deliverability.

Step-by-Step Setup:
  • In cPanel, head to the Email Deliverability section.
  • Check if the DKIM Record is already enabled. If not, generate one.
  • Add a new TXT Record for DKIM:
  • Name: default._domainkey.mydomain.com
  • Value: The DKIM key provided by your hosting provider.
  • Save the record and wait for DNS propagation.

1.3 DMARC Setup (Optional, Recommended)

DMARC based on SPF and DKIM by telling mail servers how to handle unauthenticated emails. In other word It’s add extra layer of security.

Step-by-Step Setup:

Go to the Zone Editor and add a new TXT Record:

  • Name: _dmarc.mydomain.com
  • TXT Data: v=DMARC1; p=none; rua=mailto:dmarc@mydomain.com (You can change the email address to where you’d like to receive reports).

2. Using SMTP for Reliable Email Delivery

SMTP (Simple Mail Transfer Protocol) ensures that your emails are delivered reliably, which is the best thing on shared hosting, where the default PHP mail function sometimes can be inconsistent.

2.1 SMTP Setup for Sending Emails

If SMTP isn’t preconfigured by your hosting provider, follow these steps to set it up manually for better email delivery:

  • Install a library like PHPMailer to send emails through SMTP.
  • Configure the SMTP settings:
  • SMTP Host: smtp.mydomain.com (or your provider’s SMTP server).
  • SMTP Username: your-email@mydomain.com
  • SMTP Password: Your email password.
  • SMTP Port: 587 (or 465 for SSL).

Here’s an example configuration for PHP:


$mail->isSMTP();
$mail->Host = 'smtp.mydomain.com';
$mail->SMTPAuth = true;
$mail->Username = 'your-email@mydomain.com';
$mail->Password = 'yourpassword';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;

This setup ensures that your emails are sent securely and have a much lower chance of being flagged as spam.

3. Testing Your Email Authentication Setup

After setting up SPF and DKIM, it’s quite important to test and verify that everything is functioning correctly to put your emails not ending up in spam.

3.1 SPF and DKIM Testing Tools

The tools to test your configurations:

MXToolbox:

Go to the SPF Lookup and DKIM Lookup sections on MXToolbox.
Input your domain (e.g., mydomain.com) and run the tests to check the validity of your SPF and DKIM records.

Mail-Tester:

Visit Mail-Tester and send a test email from your-email@mydomain.com to the address provided by Mail-Tester.
Analyze the detailed report, which includes diagnostics for SPF, DKIM, and spam filters.

3.2 Inspect Email Headers in Gmail

When you send an email to a Gmail account, you can examine the email headers to make sure SPF, DKIM, and DMARC are configured correctly:

  • Send an email from your-email@mydomain.com to a Gmail address.
  • In Gmail, click the three-dot menu next to the email and choose “Show original.”
  • Check for SPF, DKIM, and DMARC in the headers; they should display a PASS if the setup is correct.

Securing your email domain through proper authentication setup with SPF, DKIM, and DMARC is essential for boost email deliverability and preventing spam. Not like VPS or dedicated server, shared hosting resources are very limited, hoping this step by step guide can protect your domain’s reputation and ensure it’s deliver to intended recipients. Plus using SMTP, will boost the email reliability, make your email shown properly in the inbox and avoiding spam folder

Jesandy

"Jesus Believer, Founder of BEBRIGHT, CEO of SEOLangit.com, Digital Marketers, Brand Marketing Consultant, Game Reviewer, @zadewagaming contributors, Traveler, Movie Freaks, Pizza Lovers, SEO Specialist, Webmaster and Drupal Enthusiast"

All stories by: Jesandy

Leave a Reply

Your email address will not be published.