DEV Community

Cover image for Use Custom Domain Email On Gmail, with ImprovMX and Sendgrid
Yunus Ertürk
Yunus Ertürk

Posted on • Originally published at blog.yunuserturk.com

Use Custom Domain Email On Gmail, with ImprovMX and Sendgrid

Creating a professional email address using your domain or company's domain name is crucial to publishing credibility for your business or personal brand. In this guide, we'll walk you through setting up a custom email using ImprovMX for email forwarding and SendGrid for sending emails. This approach is straightforward, cost-effective, and doesn't require you to host your own mail server. You can make it totally for free. And i will make you with this guide to my own domain yunuserturk.com

Why Use ImprovMX and SendGrid?

ImprovMX is a fantastic tool for email forwarding. It allows you to receive emails sent to your custom domain and forward them to your existing email address, all for free. On the other hand, SendGrid provides a robust and reliable solution for sending emails, with powerful APIs that allow you to manage email sending easily. And these are not too much technical stuff to achieve.

What You'll Need

Before we dive into the setup, here are the prerequisites:

  1. A registered domain name: If you don't have one, you can purchase one from domain registrars like Namecheap or GoDaddy.
  2. ImprovMX accountSign up for a free account.
  3. SendGrid accountSign up for a free account.
  4. Gmail account. I'm sure that you already have 🙂

Step 1: Set Up Email Forwarding with ImprovMX

1. Sign in to ImprovMX

After signing up, log in to your ImprovMX account.

2. Add your domain

Enter your domain name in the ImprovMX dashboard. ImprovMX will provide you with MX records that you'll need to add to your domain's DNS settings.

Set Up Email Forwarding with ImprovMX

3. Update DNS records:

Update DNS records

  • You will see this screen on ImprovMX.
  • Go to your domain registrar's DNS settings (this is usually found in the domain management section).
  • Add the MX records provided by ImprovMX. These records should look something like:
    • MX1.improvmx.com
    • MX2.improvmx.com

Add the MX records provided by ImprovMX

  • Set the priority to the values you see.

Create forwarding rules:

Back in ImprovMX, create a forwarding rule. This will typically be something like hello@yourdomain.com forwarding to your personal email address.

Create forwarding rules

  1. Verify your setup: Once the DNS records propagate (this can take a few minutes to 48 hours), you can send a test email to your new custom address to ensure it's being forwarded correctly.

Step 2 (Easy Way): Set Up Gmail for Sending Emails

Yo need your account 2FA enabled

For this method to work, first enable your google accounts 2FA and follow this link to create an app password -> https://myaccount.google.com/apppasswords

Create an app password

Create an App Password

Google will verify your ownership with this app password. Select "Other (Custom name)" under app, and type "My Domain" as the name. Hit "Generate". Copy and keep it in a safe place!

Add your email to GmailGo to Gmail -> Settings -> Accounts and Import. Then, select "Add another email address you own" under Aliases.

Create an App Password

Fill in your sender's information

Set your forwarded email (your alias) and your sender's name. Untick "treat as an alias".

Fill in your sender's information

Fill in your email informations

SMTP: smtp.gmail.com, port is right already.\
Username: your gmail address (incl. @gmail.com)\
Password: It is the password you generated on Step 2.

Confirm ownership

You will receive an email from Gmail asking you to confirm ownership with a code. Open the link, click Confirm, and you are all set!

Confirm ownership

Send emails from your alias

Now you can just select your alias in the list when you compose a new message.

Step 2 (Harder but Better) : Set Up SendGrid for Sending Emails

Sign in to SendGrid and Verify your domain

Log in to your SendGrid account.:

In SendGrid, navigate to the "Sender Authentication" section.

SendGrid Sender Authentication

Choose "Authenticate Your Domain" and follow the prompts to add the necessary DNS records to your domain.

These will include CNAME, TXT, and possibly MX records depending on your setup.

DNS Records

After you edit your DNS settings with these setup you will verify and see this message

Verify Your Domain

Create an API key:

Go to "API Keys" under the Settings menu in SendGrid.

Click "Create API Key" and give it a name (e.g., "Custom Email API Key").

Save the generated key somewhere secure; you'll need it later.

Create API Key

Step 3: Setup Your Custom Email on Gmail

Now that you've set up ImprovMX for forwarding and configured SendGrid for sending emails, the final step is to add your custom email address to Gmail. This will allow you to send and receive emails using your new domain directly from your Gmail interface. You can see the images above for gmail settings.

Open Gmail Settings

Log in to your Gmail account.\
Click on the gear icon in the upper right corner and select See all settings.

Go to the Accounts and Import Tab

In the settings menu, click on the Accounts and Import tab.\
Scroll down to the Send mail as section and click Add another email address.

Enter Your Custom Email Address

A new window will pop up. Enter your name and the custom email address you set up (e.g., hello@yourdomain.com).\
Uncheck the option to Treat as an alias if you want to keep this email separate from your primary Gmail account.

Configure SMTP Settings

In the next step, you'll need to enter your SMTP server settings:\
SMTP Server: smtp.sendgrid.net\
Port: 587 (or 465 for SSL)\
Username: apikey\
Password: Enter your SendGrid API Key here.\
Click Add Account to save the settings.

Verify Your Email Address

Gmail will send a verification email to your custom email address.\
Since you've set up ImprovMX for forwarding, this email should arrive in your Gmail inbox.\
Open the email and click the verification link, or enter the confirmation code provided.

Gmail Confirmation

Set as Default (Optional)

If you want to use your custom email as the default sending address, go back to the Accounts and Import tab in Gmail settings.\
Find your custom email under the Send mail as section and click Make default.

Step 4: Test and Verify Your Setup

With everything set up, send a test email from your custom domain to ensure it's working correctly. You should be able to send and receive emails from your custom address directly within Gmail.

Now I can both send with my custom domain using both gmail and sendgrid services. If you are not a tech guy you can use gmails service, but I recommend to go with sendgrid!

Write me anything if you need! Happy good days.

Top comments (0)