Email Gateway Setup


Salesforce has a limit on the number of emails that can be sent and received per day using the built in email sending mechanism (Salesforce API), as well as a limit on the number of email recipients per email. We have therefore added the option in e2a to send email via an external gateway, which allows Salesforce’s limits to be bypassed. For more details of Salesforce limits please see this link.


The ‘Email Gateway’ option allows you to specify which email gateway to use for outgoing emails (that are sent via e2a). The “Default” option uses the Salesforce API which has some limitations, as mentioned above.  The “Mailgun” option uses Mailgun Email Gateway to send email.


When using the Mailgun option we need to give an ‘Email Gateway API key’ and an ‘Email Gateway Domain’. These two can be obtained by creating an account at the Mailgun website


When you are done creating an account at this website then go to the domain list and click on Domain name. Then copy the 'API key' for Email Gateway API key and copy the domain name for Email gateway Domain’ as shown below:




After getting this information, paste the API Key as it is and the Email Gateway Domain in the syntax<Domain > on to the Salesforce global setting page as shown below:


Once mailgun settings have been updated under 'e2a Global settings' you also need to setup a remote site to access mailgun services. 

When you want to access the external sites in your Salesforce application using callouts, web services, etc. you need to add that in the 'Remote Site Settings'. This is just a security that platform is going to check.


To add a remote site setting:


  1. From Setup, enter Remote Site Settings in the Quick Find box, and then select Remote Site Settings.
  2. Click New Remote Site
  3. Enter a descriptive term for the Remote Site Name. (e.g: Mailgun site)
  4. Enter the URL for the remote site. (
  5. Optionally, enter a description of the site
  6. Click Save


Please see the screenshot below for remote site configuration details:



To fight against spam, mailgun has restricted the sandbox domains to add up to 5 authorized email addresses only. You need to add these addresses under the authorized email accounts and get them verified in order to be able to send emails to them using mailgun.


Check the snapshot below of a mailgun account having authorized email addresses added for testing.



 For more details on this you can also see here Authorized Recipients in MailGun.


Please contact us at for any questions.


Was this information helpful?
Quick survey: How do you rate Email-to-anything?
★★★★ - GOOD
☆☆☆☆ - RUBBISH