Anti-spoofing for Custom Domains (SPF, DKIM & DMARC)

While there are great benefits to email’s open and decentralized nature, this freedom also makes email easy to abuse. For example, any server connected to the internet can send an email to your friend pretending to be from you. Read on to see how we can protect your custom domain from these kinds of attacks.

SPF (strongly recommended)

The Sender Policy Framework (SPF) record basically tells the world what hosts or IPs are allowed to send email for your domain. When email servers receive email that claims to be from your domain, they can look up your SPF record and if the sending server is included. While not required, we strongly recommend you set up a SPF record that includes ProtonMail. This will not only make your email seem more legitimate and thus less likely to be sent to spam folders, but it will also help protect your domain from attackers who send emails with forged headers pretending to be you.

SPF settings for ProtonMail

The recommended SPF record to add is:

SPF settings for ProtonMail

The “” means you allow the servers of ProtonMail to send on behalf of your domain. If you want to keep an existing SPF record, simply add the “” to it right after the “v=spf1”. The “mx” also includes your domain’s MX records. The “~all” means any other servers not included should be treated as a softfail, which means accept the email but marks it as SPF failed. This is better than “-all”, which would reject emails that failed SPF, and cause delivery problems for certain legitimate emails. For example, SPF often fail during email forwarding where you send to address A, which automatically forwards to address B.Once we detect your domain’s SPF record includes ProtonMail, the SPF button in Settings->Domains will turn green.

DKIM (recommended)

Domain Keys Identified Mail (DKIM) is a method of email authentication that cryptographically verifies if an email is sent by trusted servers and untampered. Basically, when a server sends an email for your domain, it will calculate an encrypted hash of the email contents using a private key (that only trusted servers know) and add it to the email headers as a DKIM signature. The receiving server will verify the email contents by looking up the corresponding public key in your domain’s DNS records, decrypting the encrypted hash, and calculating a new hash based on the email contents it received to see if the decrypted hash matches the new hash. If there is a match, then the email must not have changed and so DKIM passes. Otherwise, DKIM fails and the email is treated with suspicion.

We use CNAME records to manage automatic DKIM key rotation, which is an accepted security best practice. We ask you to add and keep three CNAME records. One of them is always used for an active key, while the other two allow our system to smoothly rotate to a new key when necessary.

It all sounds complicated, but implementing DKIM for your domain is simple in ProtonMail. It will take your DNS a couple of hours to verify your custom domain once. Once your custom domain is verified, ProtonMail will generate the host names and values you will need for your DNS to create the CNAME records that are necessary for automatic DKIM key rotation. We will send you an email notification informing you that your custom domain, host names, and values are ready.

Instructions for new users

Log in to your account, go to Settings, and click on Custom Domains in the left-hand toolbar. Once the Custom Domains window is up, click on the DKIM tab.

Here you will see the three host names and values that you will need to add to your DNS settings. Once you add these records, ProtonMail will handle the rest for you. Following the current security best practices, every six months we will generate a new 2048-bit key and use it to sign your emails.

Screenshot of DKIM settings screen.

The CNAME records you add to your DNS must be an exact match with the ones shown in your setup wizard. Once we detect these records in your DNS, the DKIM button in Settings -> Custom Domains will turn green. We will then notify you and start signing outgoing emails from your custom domain with DKIM, just like we do for other ProtonMail addresses.

IMPORTANT: Some registrars do not accept CNAME values with a period at the end (while others require it). If your registrar does not accept your CNAME records, please delete the period at the end of each CNAME value and try again.

Instructions for users that use DKIM manual key rotation

If you previously configured DKIM manual key rotation using a TXT record, you will need to remove this record from the DNS before you can enter the CNAME records. You need to reconfigure your DNS with CNAME records because they give us the ability to set up automatic key rotation while your current TXT record does not.

Once you have deleted this TXT record, you can follow the instructions for new users. DKIM will stop signing your emails once you delete the TXT record. To maintain DKIM protection, you should enter your CNAME sectors and values into your DNS immediately.

We strongly advise everyone that currently uses DKIM manual key rotation to upgrade to the new automatic key rotation. Not only will this remove the need for you to rotate your keys manually, but it will also automatically upgrade your key strength (if you were using 1024-bit keys).

DMARC (recommended)

As you were learning about SPF and DKIM, you may have wondered what exactly should the receiving server do if it gets an email which failed the checks. This is where Domain-based Message Authentication, Reporting and Conformance (DMARC) comes in to allow the domain owner to specify what should happen with failed emails as well as get feedback. Basically, there are three actions for receiving servers to take if BOTH SPF and DKIM checks fail: none, quarantine, and reject.

DMARC settings for ProtonMail

A basic DMARC TXT record:

DMARC settings for ProtonMail

The “p=” specifies the action to take for emails that fail DMARC and here, “none” basically means don’t do anything, accept the email as usual.

The “p=quarantine”, tells the receiving server to send failed emails to the spam folder. We recommend you to set this value.

Once you are confident your legitimate emails are passing DMARC, you may want to set it even more aggressively to “p=reject”. This tells the receiving server to not accept failed emails. We recommend “p=reject” if you think you are likely to be a target of spoofing. For example, Yahoo, PayPal, and eBay uses “reject” to prevent spammers from impersonating them.

The “rua=” is an optional parameter that specifies an email address where other email services can send aggregate reports to so you can see how many of your emails are failing DMARC.

However, keep in mind there are risks for choosing these actions. For instance, when you email a mailing list which then forwards to individual recipients, this will break SPF. Annoyingly, some mailing lists also change the contents of the email, which breaks DKIM, causing DMARC to fail and thus delivery issues if you have quarantine or reject.

Rate This Article

(17 out of 29 people found this article helpful)
Post Comment


  1. Mickey Anonymouse

    My registrar does not offer a field to enter in a “Host / Name”, which for the first TXT record you said is okay. But for DKIM you say that it’s essential to include ‘protonmail._domainkey’, but I have no way of doing that. So should I do DKIM at all or what?

  2. ProtonMail Support

    Please contact us at

  3. Anonymous

    Hi all, thank you for creating and maintaining protonmail. My comment is on aesthetics. I understand that you need to cover the private data on the example pictures that you have used above, and I believe it is great that you use such step by step instructions with pictures: but those black rectangles you use to cover the actual names etc is so creepy and make the page ugly. What I would do would be make those impossible to read but not by black rectangles, rather crop out the actual names/data and then edit in something conspicuous like myname@mydomain .

    Details, I know, but I think it makes for a more user-friendly guide =)

    Best of luck with protonmail!

  4. Ann Omynous

    I did include the SPF line in my DNS zone file, it’s been up for a couple of days now, but it is still not detected by Protonmail, What should I do ?

  5. ProtonMail Support

    Please contact us on or via the Report Bug button.

  6. Does is Matter

    Hello I would like to change my business emails over to you via my own domain. However, the email records are with Godaddy. How hard will this be. Presently, I’m not happy with the vendor I have. Lot’s of security leaks. Someone is reading my emails and I’m getting really creepy emails from fake addresses and my exhusband is hacking into my business mail even though he’s supposed to be blocked. Rackspace is awful.

  7. ProtonMail Support

    Can you please send us the details at

  8. Daniel

    I needed to separate each section for DKIM with double quotes: “v=DKIM1; k=rsa;” “p=……..”

  9. Bruce

    This is an excellent tutorial. It’s very informative. Thank you.
    All of your tutorial examples show a TTL of 300 seconds. Are you recommending this? Should we really be preparing for value changes every 5 minutes? If you are making a recommendation, please include it in the setup wizard.
    Also, since many of us are new at this, it would be nice to see an explanation of the standard values like “v=spf1”, “v=DKIM1”, “v=DMARC1”, “k=rsa” and even HOST/NAME: “@”.

  10. ProtonMail Support

    Once your records have propagated and are verified, you can change the TTL to a higher number.
    Thank you for the suggestions, we will take them into consideration.

  11. J.Delta

    Hey guys,
    sorry to bother. I got a question regarding
    I use it from time to time to sent mails to large numbers of peole and was wondering if there might be a way to authenticate my mail Adress with protonmail?

    That’s what it says:
    Authenticate with MailChimp by modifying your domain’s DNS records. These changes allow your campaigns to appear to come from, instead of from our servers. After you’ve made the required DNS changes, please wait 24-48 hours for the changes to propagate.

    DKIM: Create a CNAME record for with this value:
    SPF: Create a TXT record for with:
    v=spf1 ?all

    Can you help me?

  12. ProtonMail Support

    We cannot allow outside services to impersonate ProtonMail. You may be able to do this by adding a custom domain to your account.

  13. Phil

    Hi, I’ve had a custom domain attached to my protonmail pro account for a few months and yesterday I made changes to the DNS settings to allow for my wordpress page to use my domain. This morning, protonmail can’t verify my DNS.

    I’m using to manage my domains. Previously, I could see my DNS records on the godaddy DNS management page, but now it says “We can’t display your DNS information because your nameservers aren’t managed by us.” To bypass this, I created a Template and added the MX record and 3 TXT records required for protonmail. Then, I applied the template to my domain. I downloaded the Zone File and confirmed that the 4 DNS records are present. I am concerned that this template does not have an “A” or “AAAA” DNS record. Is that required?

    Does this fix the problem? Do I need to wait a full 24 hours to find out? If not, what further action do I need to take?

    Update: I determined that since wordpress is providing my nameservers, the DNS records for my custom domain email should be located in the WordPress Domains section. At least that’s my understanding, because doing so validated my DNS in protonmail. My DKIM, SPF, and DMARC settings are still showing as not set up properly, even though I added those DNS records to the wordpress DNS records. Does this take 24 hours to show properly?

  14. Anonymous


    I have a question regarding field for DKIM “Host / Name”.
    What I should enter in this field?
    1. protonmail._domainkey
    2. protonmail._domainkey.mydomainname

    Should I put my domain name in this field? Or I should indicate only “protonmail._domainkey” verbatim et literatim as you mentioned?

    Please clarify

  15. ProtonMail Support

    You just need to enter “protonmail._domainkey”, without the domain name (and without the quotes).

  16. Anonymous

    My Hosting service automatically adds mydomainname at the end of the name field like


    What should I do?

  17. ProtonMail Support

    protonmail._domainkey.mydomainname should also work and it should be properly detected by ProtonMail. If you need further assistance, please contact our support team at,, via the report bug button or using the support form at

  18. Trudy

    ‘spf.protonmail.[hidden]. 14400 IN TXT
    v=spf1 mx ~all’
    i has made an txt with the above row. My question: is the part ‘ spf.protonmail.[hidden]’ right?

  19. ProtonMail Support

    The Name/Host field should contain only @, the domain name – for example,, or just leave it blank. If you need further assistance, please contact our support team at

  20. David

    Your screen shots show “what” to change, but I don’t see any information on HOW to get to those settings screens!

    Also I would call out that on SPF records the correct format is “~all” *tilde* “all”, not hyphen or dash then “all”. That screwed me up for a while.

  21. ProtonMail Support

    DNS settings are edited at your domain registrar or DNS provider.

    Regarding the qualifier in the SPF records, all are actually valid, depending on what you want to achieve:

  22. xavier


    I’m receiving some emails with a DMARC Aggregate Report. Sadly nothing to explain what’s going on.
    Do I need to change something in my pm setting?


  23. ProtonMail Support

    You can use a tool like to help with reading the DMARC reports.

  24. Vincent Herriau

    How does one implement a custom forward filter, which will forward incoming email to select addresses, based on specific filtering criteria being met.
    Apparently, the filters and the SIEVE language allow incoming mail to be labelled and to be assigned to custom mailboxes. I could not find commands that had that mail forwarded.

  25. ProtonMail Support

    Automatic forwarding is not supported due to the encryption we utilize.

  26. Chris Forker

    Hi, can I transfer a domain to you for email hosting?

  27. ProtonMail Support

    Yes, you can. You can read more on the link below or contact our support team.

  28. Xavier

    Any ideas why I am receiving those reports at all?

  29. ProtonMail Support

    If you have a custom domain and a DMARC record set up, reports will be sent to the address in the record. DMARC reports can be received as routine reports, not necessarily linked to any emails failing the anti-spoofing checks.

  30. Christopher Kight

    I am having issues adding the SPF information with google domains.

    There is already a TXT entry with @ as the host for the verification line.
    It allows me to add the “v=spf1 mx ~all” as an additional line on that, but it won’t let me have two TXT entries with the same host.

    Have I overlooked something obvious?

  31. ProtonMail Support

    There should be a little + icon next to your verification record. When you click it, a new field will open under the existing one, where you can insert the SPF record.

Leave A Comment?