Introduction

This article will guide you through the process of setting up your own email server using Gmail and Cloudflare. By following these steps, you can manage your email without relying on third-party services, ensuring greater control and privacy.

Prerequisites

  1. Domain Name: You need a registered domain name to set up your email server.
  2. Gmail Account: A Gmail account to use as your email client.
  3. Cloudflare Account: To manage your DNS settings and enhance security.

Step 1: Set Up Your Domain in Cloudflare

  1. Log in to your Cloudflare account.
  2. Add your domain to Cloudflare if you haven’t already.
  3. Go to the email tab in the Cloudflare dashboard.

Cloudflare Email Tab

  1. Enable the Email Routing feature.
  2. Add your email address (e.g., [email protected]) and the destination email address (e.g., your Gmail address).

Cloudflare Email Routing

  1. Cloudflare will provide you with MX records.

Step 2: Test Your Email Routing

  1. Send an email to your custom domain email address (e.g., [email protected]).
  2. Check if the email is successfully forwarded to your Gmail inbox.

Step 3: Configure Gmail to Send Emails from Your Custom Domain

  1. Open Gmail and go to Settings.
  2. Click on the Accounts and Import tab.
  3. Under the Send mail as section, click on Add another email address.

Gmail Add Another Email Address

  1. Enter your name and the custom email address (e.g., [email protected]).
  2. Click on Next Step.
  3. Get an App Password from your Google Account settings if you have 2-Step Verification enabled.
  4. Choose Send through your SMTP server and enter the following information:
    • SMTP Server: smtp.gmail.com
    • Port: 587
    • Username: [email protected]
    • Password: Your App Password
  5. Click on Add Account.
  6. Gmail will send a verification email to your custom email address. Click the verification link in that email.

Step 4: Test Sending Emails

  1. Compose a new email in Gmail.
  2. Select your custom email address in the “From” field.
  3. Send the email to another address (e.g., your personal email).
  4. Check if the email is received successfully.