Overview
The article includes information to ensure that your email is not marked as spam by other servers or networks. You do not want your server to send spam. Read to know how to keep email out of the spam folder.
Use email authentication
DKIM and SPF
DKIM (DomainKeys Identified Mail) and SPF (Sender Policy Framework) authentication help verify that email comes from a trusted sender.
DKIM is an email validation system that detects the spoofing of emails. It enables your mail server to determine if the domain administrator has approved the email from that domain. The email contains a digital signature, which your mail server uses to validate the sender’s public key in their DNS record.
To combat email spoofing, SPF employs DNS records. When an email message contains fake sender addresses, SPF checks the DNS record for the sender’s domain to identify the change in the email’s header.
On servers running CentOS 7, CentOS 8, or AlmaLinux OS 8, you may notice a named warning regarding the absence of SPF resource entries on DNS.
Because RFC 7208 deprecated SPF records, this warning does not apply to CentOS 7, CentOS 8, or AlmaLinux OS 8 systems. TXT records are used instead of SPF records on CentOS 7 and 8 servers.
Both Red Hat 7.1 and CentOS 7.1 include bind-9.9.4-23.el7, an improved version of BIND that conforms with RFC 7208. To solve this problem, upgrade your operating system to a version including the most recent version of BIND. Read the Red Hat Bugzilla case regarding SPF record problems for additional details.
DMARC
DMARC (Domain-based Message Authentication, Reporting, and Conformance) is a technological specification designed to decrease the possibility of email-based abuse. A DMARC policy utilizes DNS to validate that an email message has a valid DKIM and SPF record. A DMARC also checks if the From: header matches those records.
To protect users from spam email, several email networks ask you to employ a DMARC policy. Your server must adopt a DMARC policy to avoid email rejections or spam flags within these networks.
Server PTR record configuration
A PTR record is used to map an IP address to a domain name. A PTR record is similar to a reversed A record. Configure the PTR record of your server’s IP address to use the hostname of your server. If you’ve set Exim to use a different IP address, make sure the PTR record for that IP address uses your server’s hostname.
Example of A record:
server:~ root$ dig mx1.cpanel.net +short 208.74.121.68 server:~ root$
Example of PTR record:
server:~ root$ dig -x 208.74.121.68 +short mx1.cpanel.net. server:~ root$
Spam and other networks
If email networks such as Gmail, Yahoo, or Outlook flag your server’s email as spam, you must investigate and solve the issue. You must tell the distant network if you just addressed a spam problem on your server or if you obtained a new IP address that previously delivered spam. Make sure to read the bulk sender policy of email networks.
Best practices to send bulk email
- Send all bulk emails from the same IP address.
- Use the same email address in your emails’ From: header.
- Check to see whether your email complies with RFC 5322.
- If you use HTML in your email, be sure it adheres to HTML standards.
- Make sure that the contents of your email are relevant to the subject of your email.
Related Article: Steps to Add SPF, DKIM, and DMARC Records On Your Domain
That’s how you can keep your email out of the spam folder.