Knowledgebase

How to set up Google Workspace MX, SPF and DKIM records on your domain

After you buy Google Workspace, your domain must point its email to Google. This guide shows you how to set up the Google Workspace MX, SPF and DKIM records on a domain whose DNS is managed in cPanel or the EgWeb client area, so you can receive mail in Gmail and your messages pass authentication.

Before you start

  • Know where your DNS is managed: in cPanel Zone Editor (domain pointed to our hosting), in the client area DNS management, or with another provider such as Cloudflare. See How to manage DNS records.
  • Have access to the Google Admin console (admin.google.com) as a super admin.
  • If you already use email on the hosting, create the users in Google first and plan the move, because changing MX moves new mail to Google.

Step 1: Verify the domain

  1. During Google Workspace setup, Google gives you a TXT record that starts with google-site-verification=.
  2. Add it as a TXT record on the root of your domain (name @ or your domain name).
  3. Go back to Google and click verify. If it fails, wait a little and try again (see DNS propagation).

Step 2: Add the MX record

  1. Delete the old MX records that point to your hosting mail server.
  2. Add the MX record Google shows in your Admin console. For most new setups this is a single record: priority 1, value smtp.google.com. Older setups use five aspmx records, which also still work.
  3. If the domain's DNS is in cPanel, open Email Routing in the Email section and choose Remote Mail Exchanger. This stops the hosting server from keeping mail for your domain locally.

Step 3: Add the SPF record

Your domain must have only one SPF record. If you send only through Google, use:

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

If your website or another service also sends mail as your domain, merge them in one record, for example:

v=spf1 +a +mx include:_spf.google.com ~all

Edit the existing SPF TXT record instead of adding a second one.

Step 4: Turn on DKIM

  1. In the Admin console go to Apps, then Google Workspace, then Gmail, then Authenticate email.
  2. Choose your domain and generate a new record (2048-bit is recommended if your DNS accepts it; the default selector is google).
  3. Add a TXT record named google._domainkey with the long value Google gives you.
  4. Wait for DNS to update, then click Start authentication in Google.
Tip: If the DKIM option is not ready right after creating Gmail, wait a while and try again. Copy the value exactly, with no extra spaces or quotes.

Step 5: Add DMARC (recommended)

Start with a monitoring policy, then tighten it later:

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

Learn more in Why does my email go to spam? SPF, DKIM and DMARC.

Common problems

  • Mail from the website still goes to the old mailbox: Email Routing in cPanel is still set to local. Change it to Remote Mail Exchanger.
  • Two SPF records: this makes SPF fail. Merge them into one.
  • DKIM shows "not authenticating": check the record name and value, wait for DNS, and click Start authentication again.

Frequently asked questions

Will my website stop working when I change MX?

No. MX affects email only. Your website uses A records, which stay the same.

How long until mail arrives at Google?

Often within an hour, but DNS changes can take longer to spread everywhere.

Can EgWeb set this up for me?

Yes. If you bought Google Workspace from us or host your DNS with us, open a ticket and we can help. See our Google Workspace page.

Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.

  • google workspace, mx records, spf, dkim, dmarc, gmail, domain verification

Was this answer helpful?

0 Users Found This Useful