Authenticating Mixpanel email with DKIM

DomainKeys Identified Mail (DKIM) is an email authentication standard intended to let organizations take responsibility for messages sent from their domain. You can read more about it on Wikipedia or the official website.

There are two benefits to setting up DKIM for the email you send with Mixpanel's Messages product:

  1. You can build and protect your domain's reputation among email service providers.

  2. You can get rid of the "via" header in many email clients, like Gmail. Instead of email being shown as coming from "you@your-domain.com via datadrivenemail.com", it will be shown as simply coming from "you@your-domain.com".

When Mixpanel sends email for you, it checks to see if you've set up our DKIM public key in your DNS records. If you have, we DKIM sign the mail on behalf of your domain. Thus, all you need to do to get set up is add the following DNS record to your domain.

If, for example, you would like to send a Mixpanel Messages email from you@your-domain.com you need to set up a DNS TXT record under mixpanel._domainkey.your-domain.com

"v=DKIM1\; k=rsa\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2zEodMT6gjdr8KxXuA9/Fv7MBulEH2eNFTT/2524PLpl1DcuxY3Wwi9rko0xVqNcvLt9rD+UaSxqVbzHKvIwylvplusvL5PgykuDEf9Klmle2lvyD1cbZxsgKG54pbS1tMPBwn8m9AshqESTfdJ3A1wPp6vuIHXam2quBJPCE1wIDAQAB"

The opening and closing double-quotes are a necessary part of the value of the record. Note: When you copy and paste line breaks may be introduced, which will will not work properly. Remove any line breaks or spaces from the string.

You can check the DNS record with the command line tool dig. You should get the following result (with no spaces):

$ dig +short mixpanel._domainkey.your-domain.com txt
"v=DKIM1\; k=rsa\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
iQKBgQC2zEodMT6gjdr8KxXuA9/Fv7MBulEH2eNFTT/2524PLpl1D
cuxY3Wwi9rko0xVqNcvLt9rD+UaSxqVbzHKvIwylvplusvL5Pgyku
DEf9Klmle2lvyD1cbZxsgKG54pbS1tMPBwn8m9AshqESTfdJ3A1wP
p6vuIHXam2quBJPCE1wIDAQAB"

We use it ourselves, so you can see a correct implementation, and check your record against ours, by doing:

$ dig +short mixpanel._domainkey.mixpanel.com txt

Sender Policy Framework (SPF) is an email validation system that works in tandem with DKIM to prevent email spoofing and ultimately increase your email deliverability and inbox placement rates.

To setup SPF for your domain, you will need to add the following DNS TXT record:

"v=spf1 include:datadrivenemail.com ~all"