How to Set up Salesforce Email Relay: Full Guide with Examples

On July 20, 2023
9min read
Veljko Ristić Content Manager @ Mailtrap

Salesforce email relay is a versatile tool that serves as a bridge between your Salesforce organization and your preferred email server. 

This article will delve into what this tool is, how it operates, and how you can configure it to suit your specific needs. 

Moreover, we’ll offer micro tutorials on integrations with platforms like Mailtrap, Google Gmail, and Office 365. So, let’s demystify the Salesforce email relay and explore its potential for elevating your business communications.

What is email relay in Salesforce?

An email relay is a process that facilitates email transmission from one server to another. 

However, it’s important to make a distinction between Salesforce’s own SMTP (Simple Mail Transfer Protocol) server and the Email Relay feature. 

Salesforce’s own SMTP sends (relays) emails directly from the platform. Whereas, the Email Relay feature allows you to set up a third-party SMTP, or use your own. However, you’ll still be sending emails created within the Salesforce platform. 

The emails will be routed through the servers you integrated within the system, you giving you more control over email deliverability for each domain you own. 

Also, you may have a better overview of critical metrics such as opens, bounces, and spam complaints.  

How does email relay work in Salesforce?

As said, Salesforce’s Email Relay is a process that enables your company’s SMTP server to send Salesforce-generated emails. 

This process relays the emails, as opposed to routing them directly through Salesforce’s servers. That is – the emails are routed through the SMTP servers you own or use, and integrate with Salesforce. But you can still use Salesforce templates and email personalization features. 

To integrate a third-party solution and start sending emails, you need to configure the email relay within Salesforce. Here’s what to do. 

Setting up Email Relay – Lightning Experience general steps 

  1. Type Email Relay in Lightning search and click Create Email Relay
  1. Type the SMTP credentials of your provider into the designated fields. 
  1. Once done, click the Save button and proceed to create email domain filter. 

Tip: Keep the asterisk in Sender and Recipient Domain fields to allow sending from the domain you’re using (have registered with Salesforce) to any recipient domain. 

  1. Click the box next to Active to activate the relay service, and click Save to confirm preferences.

Remember that these are just the general steps for email relay activation and setup. Later, we’ll cover detailed steps and credentials for Mailtrap, Google, and Office 365 relay server. Plus, there’s a separate section on how to test email relay configuration with Salesforce.    

Salesforce email relay limits

There are a few limitations in relation to Salesforce email relays. To help you wrap your mind around these, we’ll put them into two categories – Functional limitations and Throughput limitations (how many emails you can send). 

Functional limitations

  • Only Professional, Enterprise, Unlimited, and Performance editions have access to Email Relays. And, to an extent, you can use them with the CRM’s developer edition. 
  • Regions where the relays are available include Japan, Asia Pacific, Europe, and the Americas. This is reflected in the available Salesforce IP addresses for sending. 
  • Sender email address needs to be owned by your business, that is – the organization or domain you’re using with Salesforce needs to ‘own’ the email address. 
  • The SMTP server you’re using has to meet Salesforce’s email security compliance. Typically, it means the server must be configured to support standard email security mechanisms such as TLS. 

Throughput limitations

  • When you use the Email Relay, the limitation of 1000 emails a day, per Salesforce organization user, still applies. 
  • There’s a total daily sending limit of 5000 emails per organization.

If you need more information on the relay limits for a specific edition or cloud solution, it’s best to reach out to Salesforce support.

What are the benefits of using Salesforce email relay?

There are several benefits, but they all have a common thread – relays give you more control and flexibility in your email campaigns. And Salesforce allows you to set up multiple email relay servers. 

Consequently, you should be able to have more predictable conversions, as well as improved campaign management and recipient segmentation. 

However, when listing the benefits below, we assume you’re using a reliable SMTP provider, focused on delivery, and email server security. If not, you probably have a team of dedicated dev wizzes to back a custom SMTP server. 

Anyway, let’s break ideas into more specific chunks so you clearly understand how relays may affect your email flows.  

  • Logging compliance 

Many businesses need to abide by compliance requirements regarding email handling. Often, they need to log and store all outbound emails and the corresponding content for a specific period of time. And with an email relay, particularly an external SMTP, these logs can be kept automatically. 

Basically, the action helps with government regulation compliance. By keeping clean and comprehensive email records on auto, you fulfil regulatory compliance and save time, bar occasional maintenance. Plus, it can be easier to retrieve data. 

  • Mitigate spam filtering 

Since outbound emails get relayed from Salesforce, using your servers, the chances of them landing in the Inbox, rather than the Spam folder, are much higher. Why? 

If some of Salesforce’s shared IPs get blacklisted, this won’t affect your deliverability. And you’re relying on your own sender reputation, not Salesforce’s. 

  • Enhanced email security and authenticity 

Again, the emails get routed through your SMTP, Salesforce just relays them, so there’s much less risk of forging and email spoofing. 

In a way, the external SMTP server acts as another security layer, allowing your business to have higher authenticity of all outbound messages. Meaning, there are more chances of being recognized as a trusted sender. Thus, relays may help safeguard your domain and sender reputation. 

But keep in mind that there’s also a specific technical process to make the relay more secure. See the Important Note under Mailrap tutorial below. 

  • Content filtering and data governance 

You get more options to apply content filters and scan emails for unauthorized data or content. Simply, you can ascertain that only approved content gets sent by your domains. And, in turn, you also get to:

  • Maintain proper data governance
  • Prevent security breaches 
  • Safeguard sensitive information

How to set up an email relay in Salesforce?

Previously, we covered the general steps to configure and enable email relay on Salesforce Org. The micro tutorials below give you the details for each of the SMTP providers. Note that the general steps are the same throughout. 

Also, we assume you have Salesforce up and running, on the edition that supports Email Relays.  

  1. Type your sender domain name, and hit Add Your Domain
  1. Copy-paste the DNS records Mailtrap provides (DKIM, SPF, and DMARC) to your domain provider’s DNS records. Note that Mailtrap automatically parses your SPF record, so you don’t need to tweak anything manually.  
  1. That out of the way, you can proceed to verify your domain. Some DNS records may take up to 72 hours to update, which is outside our control. But if you want your domain to be verified faster, reach out to us at support@mailtrap.io
  1. After successful verification, go to Step 3 – SMTP/API Settings. Open Salesforce, navigate to the Email Relays menu and hit Create New Relay (as previously described). 
  1. Copy-paste Mailtrap SMTP Settings to the corresponding Salesforce Email Relay fields. Here’s a quick breakdown.
  • Host: live.smtp.mailtrap.io
  • Port: 587
  • TLS Settings: Preferred
    Enable SMTP Auth: Unchecked 

Important Note: 

To add another security layer, it’s advisable to check the box next to Enable SMTP Auth to enable SMTP authentication. Salesforce supports PLAIN and LOGIN, and so does Mailtrap, and you get the corresponding credentials under SMTP/API Settings. 
If you choose not to uncheck the box, make sure the TLS Settings are set to “Required Verify”.

  1. Finally, you can run a deliverability test with Salesforce, which we explain in a later section. And go to Step 4 and Verify Setup with Mailtrap.

Salesforce Email Relay Gmail 

There aren’t many prerequisites with Google. You need a Business account with system administrator access to G Suite, and you’re good to go. Of course, the steps below assume you already logged in and are ready to start relaying. 

  1. Within the Google Console, click Apps in the menu on the left, then select Gmail.
  1. Once inside the Gmail menu, scroll down, and select the Routing menu. Then, navigate down to the SMTP relay service section. 
  1. Click on the Edit Action, then set up the relay for Salesforce using these parameters. 
  • Allowed Senders > “Only address in my domains
  • Authentication > check the box in front of “Only accept mail from the specified IP addresses
  • Make sure to set up the IP addresses and ranges Salesforce uses for sending. Here’s the official documentation. To do it, just click Add, and copy-paste the IP address or range that works for you, then click Save to confirm. 
  1. After adding the IP addresses, leave all the default settings as is, and click Save again to confirm.
  1. Now, go back to Salesforce Email Relay setup we previously covered, and add credentials for Google. Here are the properties to include. 
  • Host > smtp-relay.gmail.com 
  • Port > 587 [Note: default port is 25, but it’s best to avoid it since it’s often blocked due to abuse] 
  • TLS Settings > Preferred
  • Enable SMTP Auth > You can keep the option unchecked
  1. That’s it, you can now run a deliverability test to inspect your relay. As sad, we’ll explain that a bit later. 

Salesforce Email Relay Office 365 

Before we start with this micro tutorial, there are some email relay considerations and limitations to note. 

  • According to Salesforce official docs, email relaying between Salesforce and Microsoft won’t work out of the box. Due to the multi-tenant nature of the services and all the corresponding authentications, there’s a chance to get an “Relay Access Denied ATTR36” error during the email handoff. Check the official docs to avoid it. 
  • You need administrative access to Microsoft Office 365. Or you could use developer editions under Office 365 Developer Program if you just want to test out the setup. 
  • You need to add and authorize a domain with Microsoft. We won’t go into details in this article, but you can check the official docs here
  • You need administrative access to Salesforce org. Salesforce.com also offers a zero-investment developer edition. You can sign up for it here, but keep in mind that it has specific limitations when it comes to relay usage and email sending. 

With that in mind, let’s go into the Office 365 micro tutorial. 

  1. In the Exchange Admin Center, go to Mail Flow, then choose the Connectors tab. 
  2. Click the ‘+’ icon to add a new connector. 
  1. You’ll see a pop-up where you need to select “Partner organization” under From, and “Office 365” under To
  2. Hit the Next button, then name and describe your connector. 
  1. Hit Next again and choose “Use the sender’s IP address” to identify Salesforce as a partner org. 
  2. Again, you click the ‘+’ icon and add all the Salesforce IP addresses. Here’s the official doc to copy-paste the addresses. 
  3. You guessed it – it’s Next again, then Save. 
  4. Move to Salesforce, and follow the previously described steps to set up a new relay. Here are exemplary credentials, but make sure double-check what Office 365 offers on your side. 
  • Host: (MX DNS record value – e.g. >yourdomain-com.mail.protection.outlook.com)
  • Port: 25 (may also want to consider 587)
  • TLS Setting: Preferred
  • Enable SMTP Auth: (unchecked)
  1. Now, you can run a deliverability test to inspect the setup. 

Pro Tips [Office 365 only]:

  • In Salesforce, navigate to Deliverability, and make sure the checkbox for “Enable compliance with standard email security mechanisms” is unchecked. 
  • If you activate bounce management with Salesforce, you either need to disable it, or create a DMARC policy. 
  • With Office 365 relay, all messages from Salesforce need X-SFDC-LK header + your Org ID. And it’s best to have a mail flow rule to restrict the email origins. 

How to test email relay in Salesforce

Testing an email relay is pretty easy and there are no complex configurations or anything. Basically, you just need to run a deliverability test, and, assuming all’s fine, you’re done. 

So, here’s a quick, step by step micro tutorial on deliverability tests in Lightning Experience. 

  1. Type Test Deliverability into the search bar, and go to the corresponding menu. 
  2. Under Email Address, type any email address you have access to. 
  1. Click the Send button, and wait a second or two for the results. Salesforce informs you when test emails get sent out. 
  2. Go to the inbox of the email address you used for sending and inspect the email. 

Pro Tips

  1. When testing email relays it’s best to go to the email headers of the message to see what’s going on. Under the X-SFDC records, you can see the Org ID, User ID, TLS settings, and all the outgoing email info to confirm the correct setup.
  2. Those who need to create access controls should go to Salesforce’s official IP ranges doc to determine which addresses to whitelist. The email relay IP ranges are at the bottom of the page. 

1, 2, 3… Configure email relay with Mailtrap

Okay, pun intended, and we’re tooting our own horn a bit. 

But, in conclusion, the Salesforce email relay acts as a bridge between your Salesforce organization and your email server, bringing greater robustness and customization options to your email communications. 

Whether it’s through Mailtrap, Google, or Office 365, configuring it to your specifications can significantly enhance the performance of your customer engagement strategies. 

The micro tutorials in this article provide a deep-dive into the integration process, ensuring you can set it up with ease. 

The Salesforce email relay is, indeed, a game-changer for businesses looking to take their email communications to new heights.

Article by Veljko Ristić Content Manager @ Mailtrap

Linguist by trade, digital marketer at heart, I’m a Content Manager who’s been in the online space for 10+ years. From ads to e-books, I’ve covered it all as a writer, editor, project manager, and everything in between. Now, my passion is with email infrastructure with a strong focus on technical content and the cutting-edge in programming logic and flows. But I still like spreading my gospels while blogging purely about marketing.