How to configure Gmail & Email Relay to avoid deliverability issues with emails sent from Salesforce.

salesforce logo

This article is here to help you out if you are receiving the error messages with the “Undeliverable” subject when sending the Email from Salesforce through your Gmail account (similar to the one on the screenshot below).

First off, we’ll need to introduce some terms or rather a term – Email Relay. In simple words, email relay is needed when you trigger the send from one address but need it to be delivered by another. For the case with Salesforce, an email is being sent from yourname@salesforce.com but the sending user has a test@gmail.com. So the ordinal sender “passes=relays” the email to the intermediate sender that is Gmail, so that Gmail is the one who does the job and the recipient sees your real address.

An official Salesforce documentation version “When this feature is enabled, our email server delivers all outbound emails to your email server, which then delivers them to the final recipients. Since your server is doing the final delivery, there is no question as to the legitimacy of the communications.”

In more technical terms SMTP relay is required to transmit messages between domains, it is a third-party application or service that mediates the process of sending, delivering and fetching email between different email hosts.

In order for Salesforce to be able to send the emails correctly from the users with the Gmail (or GSuite) addresses there is some setup to be done on both sides. Here goes

ISSUE

The emails sent from Salesfroce aren’t delivered and every time a user tries to send one there is an following error message that lands in the mailbox:

This message indicates that the Email Relay setup wasn’t done properly. Below are the steps to follow to remedy the situation.

DEBUG & SETUP

  • STEP 1: SALESFORCE

The setup has 2 parts on the Salesforce side and one on the Gmail side. We’ll start with Salesforce first

Configure Email Relay

  1. Go to Setup. In Quick search box type “Email Relay Activation” and click on the corresponding item in the menu.
  2. If you have not activated the Multiple Relays feature you will have the grey box (pic 1) click Try it now. This is an enhancement of the Relay feature that will allow you to configure several domains. If you have an existing email relay (like on the screenshot), your setting and host information will be preserved after activation so just go ahead.

  1. Click Create New Relay.
  2. Enter the following information:
    • Email Host: smtp-relay.gmail.com
    • Port: 587
    • TLS Settings: Required
    • Restrict Relay To Domains: unchecked

 

  1. Not set up Set Up an Email Domain Filter. In Quick search box type “Email Domain Filter” and click on the corresponding item in the menu.

IMPORTANT: chances are you were following all the steps above in Lightning. If this is the case you end up with no results when searching for Email Domain filters. Don’t panic, that’s another Salesforce compatibility hickup, just switch CLASSIC and repeat step 5.

  1. Click “Create New Domain Filter”. Enter the following information:
    • Sender Domain: *
      (Restricts the email relay to send emails based on the listed sender domains. This field accepts comma-separated values and supports the wildcard character (*). The default is *)
    • Recipient Domain: *
      (Restricts the email relay to send emails based on the listed recipient domains. This field accepts comma-separated values and supports the wildcard character (*). The default is *.
    • Email Relay: smtp-relay.gmail.com: 587 [TIs: required].
      Specifies the relay host for the domain filter.
    • Active: check
      Enables or disables the domain filter.

 

Configure Deliverability Settings

  1. Go to Setup – Email Administration – Deliverability
  2. Find Bounce Management, uncheck the box
  3. Under Email Security Compliance, uncheck the box next to “Enable compliance with standard email security mechanisms.” Google’s servers will manage compliance.

 

 

  • STEP 2: GSUITE / GMAIL

Not the second half of the connction – gmail configuration

  1. Connect as Admin or GSuite account.
  2. Sign up in the Google App Admin Dashboard OR sign-up to the GSuite’s Admin Gmail – Hover over the User Icon on the top right corner Manage This Domain
  3. Click -> Apps -> GSuite -> Gmail -> Advanced Settings -> SMTP

 

 

 

  1. Click Add IP Range and add the all the IP addresses from the table below. The table is grouped by region, you just need to add the ones that correspond to the regions where your users are. Or you can add them all just to be save

I recommend checking this link from time to time in case the ranges get updated  (Full list of IP’s)

The addresses used for email relay include:

IP Address
ARIN
13.108.238.129
13.108.238.145
13.108.254.129
13.108.254.145
13.110.6.177
13.110.6.193
13.110.6.225
13.110.14.177
13.110.14.193
13.110.14.225
96.43.147.65
96.43.151.65
136.146.128.65
136.146.208.17
136.146.210.17
136.147.46.177
136.147.46.193
136.147.46.209
136.147.46.225
136.147.62.177
136.147.62.193
136.147.62.209
136.147.62.225
Canada (Public Cloud)
52.60.251.176
52.60.255.176
Australia (Public Cloud)
13.210.7.176
13.210.11.176
RIPE
85.222.130.225
85.222.138.225
85.222.150.225
85.222.158.225
161.71.6.225
161.71.14.225
APNIC
101.53.164.225
101.53.172.225

 

  • Step 3. Test Deliverability

Now that you are all set it’s time to run some tests.

Email Administration | Test Deliverability.

  1. Go to Setup – Email Administration – Test Deliverability.
  2. Enter your email address and send a test message.
  3. You should receive the following emails that confirm the deliverability

4. Now send some test Email to yourself and check those are getting through. In case you are still receiving the “Undeliverable” error messages, verify the IP range and re-test.

For the curious souls here is more information on the email relay

 

As usual, if you have any additional questions, drop me a note in the comments section below.

RLATED POSTS

2 Replies to “How to configure Gmail & Email Relay to avoid deliverability issues with emails sent from Salesforce.”

  1. Interesting and very informative post!
    This article is here to help you out if you are receiving the error messages with the “Undeliverable”.
    Thanks for sharing this information with us.

    1. Ekaterina Geta says: Reply

      Hello Adrien,

      You are very welcome, I hope it was helpful!

Leave a Reply