Sail Knowledgebase

How to set up MX records for Google Workspace or Gmail

If you're planning to use Google Workspace for e-mail on your own domain name, you'll need to set up the correct MX records.

If you like Sail, don't forget to give us a star on GitHub!

Use the gmail-dns.yaml blueprint

Sail CLI ships with a default blueprint called gmail-dns.yaml which takes care of setting up all the necessary MX records for Google Workspace Gmail. Prior to applying this blueprint, you will need to add the domain to your Sail project:

sail domain add example.org

This will create a DNS zone and default records to point the domain to your Sail server. Next, you can apply the gmail-dns.yaml blueprint:

sail blueprint gmail-dns.yaml

Sail will prompt for the domain name you wish to apply the blueprint for, or you could pass one on the command line using the --domain option. After the blueprint is successfully applied, all the necessary Gmail MX records will be created at your DigitalOcean DNS servers.

You can verify this from your DigitalOcean control panel, or using the dig command line utility:

$ dig mx example.org @ns1.digitalocean.com

;; ANSWER SECTION:
example.org. 1800 IN MX 5 alt1.aspmx.l.google.com.
...

Note that it may take some time for DNS changes to propagate globally.

SMTP via Gmail

If you're also looking to send e-mails from your WordPress through Gmail, check out our Postfix SMTP guide on how to set up a fast and reliable e-mail relay service on your Sail-powered WordPress site.

If you're experiencing any trouble with e-mail or DNS while using Sail CLI, please visit our getting help section.