How to Use DMARC and DKIM to Stop Email Spoofing

Table of Contents

Email spoofing is a deceptive practice where cybercriminals forge email headers to make messages appear as though they are coming from a trusted source. This tactic is commonly used in phishing attacks to trick recipients into revealing sensitive information or clicking on malicious links. However, with the right email authentication protocols, such as DMARC and DKIM, you can significantly reduce the risk of email spoofing. Here’s how to implement these technologies to protect your domain.

Understanding DMARC and DKIM

DKIM (DomainKeys Identified Mail): DKIM allows an organization to take responsibility for a message that is in transit. It uses a cryptographic signature, which is added to the email header. This signature is created with a private key that only the domain owner has access to, while the corresponding public key is published in the domain’s DNS records. When a receiving email server gets a DKIM-signed email, it uses the public key to verify that the email was indeed sent from the domain it claims to be from and that it has not been altered in transit.


DMARC (Domain-based Message Authentication, Reporting & Conformance): DMARC builds on DKIM and SPF (Sender Policy Framework) by providing a way for domain owners to publish a policy on how to handle emails that fail DKIM or SPF checks. It also provides a way for domain owners to receive reports about the emails being sent from their domain, which can be crucial for monitoring and improving email security.

Setting Up DKIM

Setting Up DKIM

  1. Generate a DKIM Key Pair: Use a tool to generate a DKIM key pair (private and public keys). This can be done using command-line tools like openssl or online DKIM key generators.
  2. Publish the Public Key in DNS: Add a TXT record to your domain’s DNS settings. The name of this record will typically look like, where selector is a unique name you choose (e.g., default).
    Copy code IN TXT “v=DKIM1; k=rsa; p=PUBLIC_KEY”

  3.  Configure Your Mail Server: Update your mail server to sign outgoing emails with the private key. The method for doing this will depend on your mail server software (e.g., Postfix, Sendmail, or a cloud email service like Google Workspace or Office 365).

Setting Up DMARC

  1. Create a DMARC Policy: Add a TXT record to your DNS settings for your domain.
  2. The name of this record should be:
    Copy code IN TXT “v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; sp=none; aspf=r; adkim=r”

    • p: This is the policy for your domain. Options include none (monitoring only), quarantine (mark emails as spam/junk), or reject (reject the emails outright).
    • rua: Address to which aggregate reports are sent.
    • ruf: Address to which forensic reports are sent.
    • aspf: Alignment mode for SPF (r for relaxed, s for strict).
    • adkim: Alignment mode for DKIM (r for relaxed, s for strict).
  3. Start with a Monitoring Policy: Initially, set the policy to none to start collecting reports without impacting email delivery. This helps you understand the scope of the issue and adjust your SPF and DKIM settings as needed.
  4. Analyze DMARC Reports: Regularly review the DMARC reports sent to your specified email addresses. These reports will show you which emails are passing or failing SPF and DKIM checks.
  5. Adjust Policy Based on Insights: Once you are confident that your legitimate emails are properly authenticated, you can change the DMARC policy to quarantine or reject to enforce stricter handling of unauthenticated emails.


Implementing DKIM and DMARC can seem complex, but it is a critical step in protecting your domain from email spoofing and phishing attacks. By carefully setting up and monitoring these authentication protocols, you can ensure that only legitimate emails are sent from your domain, safeguarding your reputation and the trust of your email recipients.

Remember, email security is an ongoing process. Continuously monitor and adjust your settings to adapt to new threats and ensure robust protection for your domain.

Get In Touch

Subscribe to our newsletter

Receive the latest news and offers

Subscribe To Our Newsletter