In simple terms “Email Relay” means that any email that needs to go out from your Salesforce Org will be sent through your company’s email (SMTP) Server and not through Salesforce SMTP Servers.
There are different scenarios under which emails can be sent out from a Salesforce Org. For example
- User can send emails from Salesforce by navigating to a lead, contact or case record and use the ‘Email’ functionality to send emails manually
- Admins can configure the org to send emails automatically through workflow rules, process builder or flows based on certain events like creation/closure of a case
- Developers can send emails through Apex
- Users can subscribe to emails for Chatter groups and posts
- Salesforce itself can send system emails. For example for password resets, when a sandbox is ready, when sharing rules are recalulated, when weekly data export file ready and so on
Normally Salesforce uses it’s own SMTP servers to send email. But many organizations may want the mails to be routed through their email server rather than using Salesforce servers. Now this may be because of compliance & security reasons or they may not want the recipient’s email server to treat these emails as spoofing forgery
You can route all emails sent from Salesforce through your organization’s email (SMTP) server by configuring a feature called Email Relay. Configuring Email Relay is actually very simple, but if you run into issues it can easily consume a couple of days.
With this blog post and the step-by-step guide, I have tried to make the whole process of setting up Email Relay very clear and prescriptive. I have also added some troubleshooting tips towards the end so that if you do run into issues, at least you will know where to look for the problem. Check it out and …. happy relaying
(Though this guide configures email relay in Salesforce with G Suite, you should be able to follow these steps to configure it with with any other email server)
(We have discontinued our premium membership offering. If you are an existing premium member, you can still download the guides by clicking on “DOWNLOAD PDF [PREMIUM MEMBERS]” button. If you are not a premium member and want to download the guides, please sign up for our “All Access” pass. Complete details about this pass is available at this URL.)
References & Useful URLs
- Send Email from Salesforce – Help Article (5 Mts) – https://help.salesforce.com/articleView?id=emailadmin_send_email_from_salesforce_overview.htm&type=5
- Send Email Through Email Relay – Help Article (5 Mts) – https://help.salesforce.com/articleView?id=emailadmin_email_relay_overview.htm&type=5
- Considerations for Setting Up Email Relay – Help Article (10 Mts) – https://help.salesforce.com/articleView?id=emailadmin_email_relay_considerations.htm&type=5
- Set Up Email Relay – Help Article (10 Mts) – https://help.salesforce.com/articleView?id=email_relay.htm&type=5
- Setup eMail Relay To Automatically Route eMail Through SMTP – Video (4:19 mins) – https://youtu.be/GVEe-zMrslw
28 thoughts on “Step By Step Guide To Setting Up Email Relay in Salesforce with G Suite”
How about if we are sending the email through approval process. Where usually someone can reply “Approved” and it will update a status in salesforce as such. If we send email from salesforce to external email through the companies server, will the external party still be able to approve a record by replying to the email? How does one mantain the reply to address when using email relay?
Hi Christina, “Email Relay” is used for sending emails through your own email server, rather than Salesforce sending it through their server. So, the approval through email should work as-is. There shouldn’t be any impact on this because of “Email Relay”. But then please do test it out to validate.
Is email relay required to prevent the email account from being blacklisted?
No Lalit, that is not the purpose of Email Relay. You will configure email relay when you want to route all the emails from your company’s email server, because of security & compliance reasons and/or better deliverability.
Thanks, Ashish!! What precaution to take while sending mass emails from Salesforce so that the sender email does not get blacklisted. I read in another blog to use email relay to avoid the appearance of ’email spoofing’ forgeries.
Also, do you recommend any SMTP services to use for email relay like Postmark.com?
Hi Lalit, to avoid getting blacklisted, the basic rule of thumb is that do not send emails to people who have not subscribed/given consent to receive your emails. Or in other words do not spam people.
Email Relay is one way to avoid the appearance of email spoofing. But there are other ways also like setting up SPF, DKIM and DMARC on your domain to avoid appearing as email spoofing. You will need to do some research to understand these terms and how to set them up.
I do not have any recommendations on using a particular SMTP service for email relay and I am not aware of Postmark.com. But normally it is set to the email service provider that you are using like Google Workspace, Microsoft 365 or Microsoft Exchange.
I followed the instructions and tested deliverability. The system sent out 2 messages but i only received one with IP address 18.104.22.168 that I did not whitelist. I tried to add the IP address indicated in the log but still only received one message. There was no email log in G-Suite and the email log from Salesforce has this error “550-5.7.0 Mail relay denied [22.214.171.124]. Invalid credentials for relay for\r\n550-5.7.0 one of the domains in: (as obtained from HELO and MAIL FROM).\r\n550-5.7.0 Email is being sent from a domain or IP address which isn’t registered\r\n550-5.7.0 in your G Suite account. Please login to your G Suite account and\r\n550-5.7.0 verify that your sending device IP address has been registered within\r\n550-5.7.0 the G Suite SMTP Relay Settings “
Hi LiPing, The error message indicates that the “verify that your sending device IP address has been registered …” Can you check the IP configuration in GMail settings? Please also check out this artilce “Ensure you can receive email from the Salesforce application”
If it still doesn’t work, you may want to log a case with Salesforce support for further troubleshooting.
Thank you for your guide, very clear and useful. When i tested the deliverability, it sent out 2 messages but I only received one. May I confirm how I should add the IP range, with this range, for example : 126.96.36.199 – 188.8.131.52, do I add 184.108.40.206 , 13.109,128.1, 220.127.116.11 ….through to 18.104.22.168 ? or I will have 2 entries in the IP range ? Thanks.
Hi LiPing, the last I checked, we needed to add the IP addresses individually. But please verify again. Things might have changed since then.
My client wants all emails sent through various channels should be directed to common email. For example, using a form where we input firstname.lastname@example.org, another user fills form using email@example.com. After submission of these forms, emails should go to firstname.lastname@example.org. The reason for this was, in UAT and training sandboxes, there are chances testers send mail to actual agents mails ids.
Will this be possible using Email relays or any other email setup.
Hi Imran, I have not sure if I have understood your requirement. Do you mean that emails sent to email@example.com or firstname.lastname@example.org should actually be sent to email@example.com? I don’t think that’s possible. However, if you are worried about emails being sent out from Sandbox, there is a setting under Setup -> Email -> Deliverability -> Access level. You can set the value of this to ‘No Access’ or ‘System Email Only’. This will turn off sending of emails from Sandbox.
Is it necessary to disable Active Bounce Management and Enable compliance with standard email security mechanisms for this to work? These seem like good things to keep active.
Hi Erik, I think it is necessary to disable those settings. When I tried without disabling those settings, the relay didn’t work.
Thank you for this guide.
When I sent a test through the Test Deliverability page in Salesforce it only sent 2 messages. I didn’t get one of them. I was able to use the Email Log Search in G-Suite, as you instructed, to see that the email was sent through an IP address I hadn’t added (22.214.171.124). I added it, and now I am getting both emails. However, that address was not in the list at https://help.salesforce.com/s/articleView?id=000321501&type=1.
Should I be worried that there are other IP addresses will be used that I haven’t added?
Perhaps this is related, but on that page each of the IP address are listed with a /number. For instance, the first one is 126.96.36.199/14. I got errors in G-suite when including the /number, so I entered them without the /, for instance 188.8.131.52. Also, some ranges are listed, for instance 184.108.40.206 – 220.127.116.11, but I also got errors when trying to enter these.
Hi Erik, please note the following
1. I can see the IP address “18.104.22.168” at URL https://help.salesforce.com/s/articleView?id=000355539&type=1. It will fall within the range 22.214.171.124 – 126.96.36.199 listed on the URL
2. 188.8.131.52/14 is a CIDR format. To convert it to an IP Range format, you can use the site https://www.ipaddressguide.com/cidr
3. I don’t think you can enter the range in GSuite. Unfortunately, you will have to enter the IP addresses individually.
Hope this helps. Regards, Ashish
How do I set this up for Office 365.
This is a very useful article. Thank you for sharing.
Hi Vasanthi, I do not have a lot of experience configure email relay with office 365. But see if this article helps – https://help.salesforce.com/articleView?id=000337644&type=1&mode=1
Great read, Ashish. Is there an SMTP of salesforce that we can use as a relay?
Hi Aditya, by default (that is if you don’t setup email relay), all the emails go through Salesforce’s SMTP server only.
Hi Ashish, the step-by-step is very simple and easy to follow. I followed the steps and successfully setup the email relay from SF to our G Suite. The weired “via” strings following Sender’s email is gone. Thank you.
However, every email we sent out from SF also shows up in the Inbox of the sender’s Gmail. Any idea why and how can we turn this off?
Hi Olivia, thanks for your feedback. Emails sent out from Salesforce through email relay will appear in the ‘Sent’ items in GMail. It should not appear in Inbox. Can you email me the screenshot of the Gmail inbox and also of the email header in Gmail where it shows the from, to, cc, date and subject fields and I will take a look. Just be sure to blur the fields that are sensitive. You can email these to me at ‘firstname.lastname@example.org’.
Hi Ashish, I am looking at the email log from SF. It seems every email sent out from SF, a email is also sent to the sender’s email at the same time. Any idea where in SF may have a setting that cause this to happen?
Hi Olivia, you can check if the ‘Compliance BCC Email’ is set under Setup. This is at the org level. There is also an option for ‘Automatic Bcc’ under User’s Settings -> Email -> My Email Settings.
Found it. It’s the “Compliance BCC Email”. Thanks Ashish.
Great. My pleasure Olivia.
I have followed these instructions but when I test deliverability I don’t get any emails. I am using G Suite Nonprofit. When I download the email log, some of the email have this error message: “454 4.4.4 [internal] no MX or A for domain”. Others have no error message.
Emily was able to resolve the problem by contacting Google support. She made 2 changes that made it work. These changes were enabling SMTP authentication in Email Relay setting in Salesforce and enabling less secure apps in GSuite. Posting this update here for other readers’ benefit, in case they are running into the same issue.