Gmail DNS Settings: MX Records vs SPF and DKIM for Configuring Gmail Email

Gmail DNS Settings: MX Records vs SPF and DKIM for Configuring Gmail Email

To make Gmail work with your domain, set Google MX records first, then add SPF and DKIM so messages from you do not look fake. MX records handle receiving. SPF and DKIM help with sending safely. Mix them up and email gets weird fast.

TLDR: MX records tell the internet where to deliver mail for your domain, like sending hello@yourshop.com to Gmail. SPF says, “Google is allowed to send mail for me.” DKIM adds a private signature, so inboxes trust the message more. For example, a 5 person bakery that moved to Google Workspace saw fewer customer replies land in spam after adding SPF and DKIM, cutting support complaints by about 40% in two weeks.

MX, SPF, and DKIM: the tiny DNS trio with big email energy

DNS settings sound like something guarded by a wizard in a basement. They are not. They are just public notes about your domain. Email servers read those notes and decide what to do.

For Gmail with a custom domain, the three big records are:

  • MX records: Tell mail where to go.
  • SPF record: Tells others who can send mail for your domain.
  • DKIM record: Adds a digital signature to your outgoing mail.

Think of your domain as an apartment building. MX records are the front desk. SPF is the approved delivery driver list. DKIM is the wax seal on the envelope. Fancy? A bit. Useful? Very.

What are Gmail MX records?

MX means Mail Exchange. These records tell the world where to deliver email for your domain.

If someone emails alex@coolbeanscoffee.com, their mail server asks DNS, “Where does this domain receive mail?” Your MX records answer, “Send it to Google.”

For Google Workspace, the classic Gmail MX records look like this:

  • Priority 1: ASPMX.L.GOOGLE.COM
  • Priority 5: ALT1.ASPMX.L.GOOGLE.COM
  • Priority 5: ALT2.ASPMX.L.GOOGLE.COM
  • Priority 10: ALT3.ASPMX.L.GOOGLE.COM
  • Priority 10: ALT4.ASPMX.L.GOOGLE.COM

The lower number wins first. So priority 1 is tried before priority 5. If the main Google mail server is busy, the backup ones step in.

The catch is that DNS panels love to hide things behind strange labels. Some call the name field Host. Some call it Name. Some want @. Some want your full domain. It drives me a little mad that the same simple record can look different in every control panel.

What does SPF do?

SPF means Sender Policy Framework. It is a TXT record. It says which mail servers are allowed to send email for your domain.

For Gmail, a simple SPF record often looks like this:

v=spf1 include:_spf.google.com ~all

That line says, “Google can send mail for this domain. Treat other senders with suspicion.”

SPF helps stop spoofing. Spoofing is when someone pretends to send email from your domain. Like a scammer sending fake invoices from billing@yourcompany.com. Not cute. Not fun.

SPF is checked by receiving mail servers. If your message comes from Google, and your SPF record allows Google, the message gets a trust point. If it comes from some random server, it may fail.

What does DKIM do?

DKIM means DomainKeys Identified Mail. Yes, the name sounds like it was built by a committee after too much coffee.

DKIM adds a digital signature to your outgoing email. Gmail signs the message with a private key. Your DNS holds the matching public key. Receiving servers compare the two.

If the signature matches, the message is more trusted.

DKIM helps prove two things:

  • The email really came from your domain setup.
  • The message was not changed on the way.

With Google Workspace, you generate a DKIM key in the Admin console. Then you copy a TXT record into DNS. It often uses a name like:

google._domainkey

The value is a long string. It may look ugly. That is normal. Do not edit it for style. DNS does not care about your design taste.

MX vs SPF vs DKIM: the simple difference

Here is the short version.

Record Job Used for
MX Routes incoming mail Receiving email in Gmail
SPF Approves sending servers Reducing fake sender problems
DKIM Signs outgoing messages Improving trust and delivery

If MX is wrong, people may not be able to email you. If SPF is wrong, your outgoing email may look suspicious. If DKIM is missing, Gmail can still send, but your mail has less proof behind it.

So yes, you need all three for a clean Gmail domain setup.

How to configure Gmail DNS settings

Here is the friendly version. No cape needed.

  1. Open your domain DNS settings. This is usually where you bought the domain.
  2. Add Google MX records. Remove old mail provider MX records first.
  3. Add SPF as a TXT record. Use v=spf1 include:_spf.google.com ~all if Google is your only sender.
  4. Generate DKIM in Google Admin. Go to Gmail authentication settings.
  5. Publish the DKIM TXT record. Copy it exactly.
  6. Turn on DKIM signing. Do this back in Google Admin after DNS updates.
  7. Send a test email. Check the message headers if you want proof.

Expect to waste time on propagation. Sometimes records show up in 5 minutes. Sometimes it takes a few hours. The most annoying version is when one checker says it works and another says it does not. Give it time. Then test again.

Common mistakes that break Gmail email

Email DNS is small. The mistakes are also small. The pain is not.

  • Leaving old MX records in place. Mail may go to the wrong provider.
  • Creating two SPF records. You should have one SPF TXT record only.
  • Forgetting third party senders. If Mailchimp or Shopify sends mail for you, SPF may need them too.
  • Copying DKIM with missing characters. One tiny cut can break the whole key.
  • Using the wrong host name. Some DNS hosts want @. Others want the full domain.
  • Not enabling DKIM after adding DNS. Publishing the key is not always the final step.

What about DMARC?

DMARC is the next piece. It tells inboxes what to do when SPF or DKIM fails. It can say, “Watch this,” “Send it to spam,” or “Reject it.”

A gentle starter DMARC record can look like this:

v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com

This does not block mail. It collects reports. Start soft. Then tighten later. Jumping straight to reject can block real email if SPF or DKIM is not ready.

Do personal Gmail users need this?

If you use yourname@gmail.com, no. Google handles the DNS. You do not own the gmail.com domain.

If you use Gmail with you@yourdomain.com through Google Workspace, yes. You need domain DNS records. That is where MX, SPF, and DKIM come in.

The best setup for most Gmail domain users

Use Google MX records for receiving. Add one SPF record that includes Google. Turn on DKIM with a 2048 bit key if your DNS host supports it. Then add DMARC in monitoring mode.

That setup gives you a strong base. It helps customers reach you. It helps your messages reach them. It also makes scammers work harder, which is always a win.

Simple rule: MX gets mail into Gmail. SPF and DKIM help your Gmail messages get trusted. Set all three, test them, and your domain email will feel much less cursed.