Email Server with ISPConfig3, Google Cloud, CloudFlare and Mozilla Thunderbird.

Follow these steps to setup a virtual server in GCP that you can use to setup a custom email account. For example: [email protected]

Customer recently expirienced a migration with their GoDaddy account. Godaddy is no longer offering email servers and they are shifting all their customers to MS Office 365 for a fee where as before it was free. We've been receiving many complains from Godaddy customers and their migration efforts. This tutorial helps you get an email server on Google Cloud Platform.

Setup ISPConfig 3.

1. Create an email account in the ISPConfig Control Panel. Email > Email Accounts > Email Mailbox > Add new Mailbox

28-p4983-1-ispconfig-email-mailbox.jpg

2. Populate the fields and click save.

  • Name: Name of your email account
  • Email @ Domain: [email protected]
  • Password: Select a strong password
  • Enable Receiving

28-p4983-2-ispconfig-mailbox.jpg

3. To enable Catch All, go to Email Accounts > Email CatchAll and Click on the "Add new Catchall" button.

28-p4983-3-ispconfig-catchall.jpg

4. Catch All Form: Populate the following:

  • Source: Select the domain name in you ISPConfig accounts
  • Destination Email: Assign the email you want to assign as the catchall to forward all your emails to. (example: [email protected] from step 2)
  • Active: Checked

5. now that you have your email settings, go to Email Accounts > Email Mailbox and open the email client by clicking on the envelope icon, for this example, I will be using SquirelMail.

28-p4983-5-ispconfig-email-client.jpg

6. Login with your email and password you setup in step 2.

7. You can now access your email account through Squirmail

28-p4983-7-ispconfig-email-squirrelmail.jpg

Setup Google Cloud.

1. Login to your Google Cloud Account: example URL: https://console.cloud.google.com/networking/firewalls/list?project=[PROJECT ID]

2. Click on Create Firewall Rule (See previous image)

3. Set the following Field Values:

  • Name: smtp-egress
  • Description: SMTP Traiffc - Egress (Going Out)
  • Logs: Off
  • Network: Default
  • Priority: 1000
  • Direction of Traffic: Egress
  • Action on match: Allow
  • Targets: Select Specified service Account
  • Service Account Scope: In this project
  • Target Service Account: [Select your ispconfig vm instance]
  • Destination filter: IPv4 ranges
  • Destination IPV4 ranges: 0.0.0.0.0/0
  • Protocols and ports: Check: Specified protocols and ports: tcp: 25 / upd: 25
  • Click Create

4. Now your firewall rules should look something like this:

28-p4983-1-google-cloud-platform-firewall-rules.jpg

Setup Mailjet SMTP Service (Free)

1. Login to you Mailjet account and and go to the settings dashboard. https://app.mailjet.com/account

2. Go to the Senders & Domains card:

  • Add A domain name: Add the domain name you will be using for your email address. This is from the ISPConfig domain.
  • Setup SPF/DKIM Authentication - To improve your sender reputation and deliverability, we strongly recommend that you set up a few DNS records. Write down the "IN TEXT" value, you will need it for the next steps in DNS Settings.
    help: https://documentation.mailjet.com/hc/en-us/articles/360042412734-Authenticating-Domains-with-SPF-DKIM
    Add a Sender Domain or Address - Add a sender address and make sure to validate it. Do not use any public emails address like yahoo, gmail etc..
  • SMTP and SEND API Settings https://app.mailjet.com/account - in this section, you will need to setup and an API Credentials. Once you have created it, make sure to note the API key and the secret key. These will be your login and password for Thunderbird in the next steps.

Before you go to the DNS settings, be sure you have an API key and its secret key, you have setup the domain and have created and validated a senders domain address. Also make sure you to note the "IN TXT" value.

Your settings should now look like this:

28-p4983-5-mailjet-senders-domains-card.jpg

Setup DNS (CloudFlare).

1. Login to you CloudFlare account and select the domain name for your email adress.

2. Go to the DNS Settings and add a MX record with the following properties:

MX Record:

  • Type: MX
  • Name: example.com
  • Mail Server: You Google Cloud Public Ip Address (example: xxx.xxx.xxx.xxx.bc.googleusercontent.com)
  • TTL: Auto
  • Priority: 0

TXT Record for MailJet

  • Type: TXT
  • Name: @
  • TTL: Auto
  • Content: [You get this from the SPC section in Mailjet. See picture and look for the SPF section) (example: v=spf1 include:spf.mailjet.com ?all)

Setup Mozilla Thunderbird

Set Up Your Existing Email Address  To use your current email address fill in your credentials.  Thunderbird will automatically search for a working and recommended server configuration.

1. File > New > Existing mail Account..

2.Complete the form:

  • Your full name: First Last Name
  • Email address: [email protected]
  • Password: the ISPConfig Email password.

28-p4983-2-thunderbird-settings-email.jpg

3. DO NOT CLICK ON CONTINUE! Instead, click on "Configure manually"

4. Under manual configuration, provide the following:

  • INCOMING SERVER:
  • Protocol: POP3
  • Hostname: [Get the public IP Address from your server in your GCP account]
  • Port: 110
  • Connection Security: None
  • Authentication method: Normal Password
  • username: [email protected]

OUTGOING SERVER - Google Cloud automatically blocks all outgoing email traffic on port 25 SMTP.

IMPORTANT: You will not be able to use this account to send outgoing emails, only incoming.

  • OUTGOING SERVER:
  • Hostname: You will get the host name from the MailJet Step 2 section: SMTP and SEND API Settings (example: in-vxxx.mailjet.com)
  • Connection Security: SSL/TLS
  • Authentication method: Normal Password
  • username: THIS WILL BE THE API KEY (NOT THE SECRET KEY)
  • Password. [THIS FIELD IS NOT IN THE FORM] THE PASSWORD WILL BE THE SECRET KEY OF THE API KEY IN MAILJET. YOU MIGHT BE PROMPTED TO ENTER IT WHEN YOU SEND EMAISL IN THUNDERBIRD.

Click Done.

NOTE: for the SMTP settings, you can change these settings to the following by going into the account settings in Thunderbird:

UPDATE: please not on this picture, the username is not the API SECRET KEY, but just the API Key.

28-p4983-6-mailjet-smtp-settings-in-thunderbird.jpg

The following picture shows the form in thunderbird when I was adding the account.

28-p4983-4-thunderbird-server-settings-email.jpg

I confirmed I was able to fetch my emails from the ispconfig server in the google cloud. but unable to send emails. Next> will figure out a way to send emails with relay service? or smtp provider.

Resources:

  • https://dash.cloudflare.com
  • https://console.cloud.google.com
  • https://app.mailjet.com
  • https://www.thunderbird.net
  • https://www.ispconfig.org/
  • https://squirrelmail.org/
  • https://cloud.google.com/compute/docs/tutorials/sending-mail/using-mailjet
  • https://cloud.google.com/vpc/docs/firewalls#blockedtraffic
  • https://www.howtoforge.com/community/threads/catchall-forward.36197/
  • https://www.youtube.com/watch?v=2z_KCEopK_Q&t=5s
  • https://www.youtube.com/watch?v=rgNJQsD08pI
  • https://unix.stackexchange.com/questions/306195/how-to-check-whether-port-25-is-open-or-blocked
  • https://www.godaddy.com/help/catch-all-email-not-supported-with-microsoft-365-40130