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 email@example.com but the sending user has a firstname.lastname@example.org. 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
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
- Go to Setup. In Quick search box type “Email Relay Activation” and click on the corresponding item in the menu.
- 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.
- Click Create New Relay.
- Enter the following information:
- Email Host: smtp-relay.gmail.com
- Port: 587
- TLS Settings: Required
- Restrict Relay To Domains: unchecked
- 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.
- 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.
- Sender Domain: *
Configure Deliverability Settings
- Go to Setup – Email Administration – Deliverability
- Find Bounce Management, uncheck the box
- 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
- Connect as Admin or GSuite account.
- 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
- Click -> Apps -> GSuite -> Gmail -> Advanced Settings -> SMTP
- 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:
|Canada (Public Cloud)|
|Australia (Public Cloud)|
Step 3. Test Deliverability
Now that you are all set it’s time to run some tests.
Email Administration | Test Deliverability.
- Go to Setup – Email Administration – Test Deliverability.
- Enter your email address and send a test message.
- 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
- Salesforce Help Documentation: How to Setup Email Relay
- Salesforce Knowledge forum: Enabling Email Relay
- Salesforce IP Addresses & Domains to whitelist – Full List of IPs