The Ultimate Guide to Setting Up DKIM, SPF, and DMARC in Virtualmin

Learn how to configure DKIM, SPF, and DMARC in Virtualmin to improve your email deliverability and avoid spam. Step-by-step guide for maximum security.

Why are DKIM, SPF, and DMARC important?

If you send emails from your own server, it is crucial that they actually land in your recipients' inboxes. Without authentication methods like DKIM, SPF, and DMARC, your messages are often marked as spam or not delivered at all. These three technologies work together to prove that your emails are legitimate and not forged by an attacker.

Prerequisites

Before you begin, make sure you:

  • Have access to Virtualmin as an administrator
  • Own a domain for which you can manage DNS records
  • Have basic knowledge of DNS settings

Step 1: Set up SPF record

SPF (Sender Policy Framework) specifies which servers are authorized to send emails for your domain. Here's how to create the record:

  1. Open your domain's DNS management
  2. Add a TXT record with the value: v=spf1 mx include:_spf.google.com ~all (adjust the include values to your mail server)
  3. Alternatively, you can have the record generated automatically in Virtualmin under Email → SPF Settings

Step 2: Generate DKIM key in Virtualmin

DKIM (DomainKeys Identified Mail) digitally signs your emails. Here's how to set it up:

  • Go to Virtualmin under Email → DKIM Settings
  • Click on Generate DKIM key pair
  • Select the domain and confirm
  • Virtualmin will display the public key as a DNS record – copy it

Step 3: Add DKIM DNS record

Add the copied DKIM record as a TXT record in your DNS management. The name of the record is usually default._domainkey. Once the record is active, you can test the signature.

Step 4: Set DMARC policy

DMARC (Domain-based Message Authentication, Reporting & Conformance) tells recipients how to handle emails that fail SPF or DKIM. Here's how to configure it:

  • Add a TXT record with the name _dmarc
  • The value could be: v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com
  • The parameter p can be none, quarantine, or reject – start with none and increase later

Step 5: Test configuration

Use tools like Mail-Tester or MXToolbox to check if all records are correct. Send a test email and analyze the results.

Avoid common mistakes

  • SPF too restrictive: If you forget important mail servers, emails may be rejected
  • DKIM key not active: After adding the DNS record, it may take up to 24 hours
  • DMARC too strict: Initially set p=none to avoid blocking legitimate emails

With these settings, you ensure that your emails arrive reliably and your domain is protected from abuse. If you are looking for a reliable web host with easy Virtualmin management, check out our Web Hosting Packages – including free SSL certificates and support!