Step By Step Guide To Setting Up Email Relay in Salesforce with G Suite

Salesforce Email Relay

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

  1. User can send emails from Salesforce by navigating to a lead, contact or case record and use the ‘Email’ functionality to send emails manually
  2. 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
  3. Developers can send emails through Apex
  4. Users can subscribe to emails for Chatter groups and posts
  5. 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)

References & Useful URLs

26 thoughts on “Step By Step Guide To Setting Up Email Relay in Salesforce with G Suite”

    1. 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.

      1. 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?

        1. 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.

  1. I followed the instructions and tested deliverability. The system sent out 2 messages but i only received one with IP address 101.53.164.208 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 [101.53.164.209]. 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 “

  2. 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 : 13.109.128.0 – 13.109.159.255, do I add 13.109.128.0 , 13.109,128.1, 13.109.128.2 ….through to 13.109.159.255 ? or I will have 2 entries in the IP range ? Thanks.

    1. Hi LiPing, the last I checked, we needed to add the IP addresses individually. But please verify again. Things might have changed since then.

  3. My client wants all emails sent through various channels should be directed to common email. For example, using a form where we input abc@xyz.com, another user fills form using def@lmn.com. After submission of these forms, emails should go to commonemail@xyz.com. 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.

    1. Hi Imran, I have not sure if I have understood your requirement. Do you mean that emails sent to abc@xyz.com or def@lmn.com should actually be sent to commonemail@xyz.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.

  4. 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.

    1. Hi Erik, I think it is necessary to disable those settings. When I tried without disabling those settings, the relay didn’t work.

  5. 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 (13.110.6.209). 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 13.108.0.0/14. I got errors in G-suite when including the /number, so I entered them without the /, for instance 13.108.0.0. Also, some ranges are listed, for instance 66.231.80.0 – 66.231.95.255, but I also got errors when trying to enter these.

    1. Hi Erik, please note the following

      1. I can see the IP address “13.110.6.209” at URL https://help.salesforce.com/s/articleView?id=000355539&type=1. It will fall within the range 13.110.6.208 – 13.110.6.223 listed on the URL

      2. 13.108.0.0/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

  6. Vasanthi Nandhakumar

    Ashish

    How do I set this up for Office 365.
    This is a very useful article. Thank you for sharing.

    1. Hi Aditya, by default (that is if you don’t setup email relay), all the emails go through Salesforce’s SMTP server only.

  7. 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?

    1. 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 ‘ashish@asagarwal.com’.

      1. 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?

        1. 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.

  8. 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.

    1. 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.

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top