How to Send Emails in Salesforce
Published: 2023-12-25 09:28:03

As a robust CRM platform, Salesforce enables users to send all sorts of emails from its platform, from customer service emails to full-blown automated marketing campaigns. 

However, it can be a bit hard to figure out which method you should be using. Should you send emails with Gmail or Yahoo? Should you use an Email Relay? Maybe you should build Flows and send automated emails? 

In today’s comprehensive guide, we answer all these (and some other) questions and provide a step-by-step tutorial on sending emails from Salesforce. 

## Email sending limits in Salesforce 

Salesforce has several sending limitations based on the type of account and plan you’re using. 

### Sending limits for licensed orgs 

Each licensed Salesforce org (i.e., orgs using the paid services) is allowed to send single emails to up to 5,000 external email addresses per day. The daily email limit is based on GMT and is renewed after midnight. By ‘external’ emails, Salesforce means any addresses not associated with a Contact, User, or Lead. The same limitation applies while sending mass or list emails. 

For orgs registered before Spring 2019, the daily limit is enforced only when using Apex or Salesforce APIs with the exception of REST APIs. 

For orgs registered in Spring 2019 or later, the daily limit also applies to emails sent through email alerts, simple email actions, Send Email actions, and REST API. 

Additionally, each user in the org has their own hourly limits – they can send emails to up to 250 external recipients per hour. 

Do keep in mind that each email address in the ‘To’, ‘Cc’, and ‘Bcc’ fields counts as a separate call while sending emails from Apex or API. So, if you had one address in each, it would count as three emails. 

If you attempt to send emails after reaching this limit, you’ll encounter an error (SINGLE_EMAIL_LIMIT_EXCEEDED). 

For more details, refer to the [official Salesforce documentation](https://help.salesforce.com/s/articleView?id=sf.allocations_email_general.htm&type=5). 

### Sending limits for developer and trial accounts 

Developer Edition and trial orgs have less generous daily limits. Each user can send emails to up to 50 recipients per day, with each email having a maximum of 15 recipients per day. Up to 10 recipients per day are allowed if you’re sending a List Email or Mass Email. 

Also, you can have only 15 recipients per day in workflows. 

These limits apply to user-to-user, Apex, workflow, mass, and single emails. 

## How to send email in Salesforce 

There are multiple email-sending configurations both in Salesforce Classic and Salesforce Lightning Experience. These configurations vary based on the email service provider or [email infrastructure](https://mailtrap.io/blog/email-infrastructure/) you’re using. 

### How to send emails through external email services 

The easiest way to send emails from Salesforce is via Gmail or Microsoft 365 (labeled as Office 365 in the UI). You can switch on sending directly from the platform without having to go back and forth between your Gmail/Microsoft 365 and Salesforce accounts. 

For all the instructions below, we’ll assume you’ve already set up Salesforce account. If not, go to salesforce.com, choose the desired subscription, and fill out the registration form (or contact support, depending on the product you’re choosing). 

_The following steps apply to both Lightning Experience and Classic versions._ 

Sign into your Salesforce account and navigate to _Setup_.

![Navigating to Setup in Lightning Experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1qiyovnny4uikag70lmr.png)


![Navigating to Setup in Salesforce Classic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8aonom2gt0v3vhl6gvbd.png)

In the Quick Find box, type in Send through External Email Services, hit enter, and click on the search result. 

![Send through External Email Services in Lightning Experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wiwm5g8wrsgwbb8csx3u.png)


![Send through External Email Services in Salesforce Classic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g0g7jwk6211l0qkjokxh.png)

Toggle either Gmail or Office 365, depending on which one you will use. 

![Configuring external email services in Lightning Experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7swh9lorizivqtexwyi.png)

![Configuring external email services in Salesforce Classic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/63fihcv3h4afhdwsoevz.png)

Then head over to the _Deliverability_ under _Email (Email Administration in Classic)_ in _Setup_ and set _Access to Send Email (All Email Services)_ to _All Email_. This will allow you to send all types of outbound emails. 

![Configuring deliverability in Lightning Experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gfepnszcik8efro7vika.png)


![Configuring deliverability in Salesforce Classic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/954dzxs2svdx2t43uadv.png)

To configure email settings, go to Settings → My Email Settings. There, modify the sender name or set the email signature. You can also toggle between Send through Salesforce and Send through Gmail/Office 365 features. Once you’re done, click Save. 

Note: The ability to change the sender name is only available for Gmail users. If you’re using Office 365, you won’t be able to access this feature. 


![Configuring email settings in Salesforce Lightning Experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rvjfnykaxewji2qy5lvp.png)


![Configuring email settings in Salesforce Classic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xrdbzuz4vpvvhunjnjv1.png)

Then, choose a contact to send an individual email or select a template. We go over different sending cases below. 

Tip: Use Salesforce integration with Outlook and Gmail for seamless synchronization between the platforms. You’ll learn how to handle the setup [here](https://mailtrap.io/blog/salesforce-email-integration/). 

A couple of things to keep in mind: 

- If you’re using Communities, you won’t be able to send emails with Gmail or Office 365. 
- This feature isn’t available for Einstein Activity Capture and Salesforce Inbox users either. 
- The emails you send through Gmail and Office 365 won’t be stored in Salesforce email logs, making it harder to track email delivery and deliverability. However, you can still access them in your email client or Gmail/Office 365 accounts. 
- You can’t send emails from organization-wide email addresses with Gmail or Office 365. They are usually sent through Salesforce. 
- Bounce management isn’t available with this feature. 
- List emails and emails sent by triggers and workflow rules are sent from Salesforce, not from Gmail or Office 365. 

## How to send emails with your own domain and Salesforce 

To sidestep the limitations of the Send through External Email Services feature, you can send emails directly from Salesforce. However, this functionality only works if you have your own domain. You could use Gmail, Outlook, or Yahoo/AOL accounts, but you’d still have to get a custom domain. 

If you send emails directly from Salesforce, you’ll be leveraging the email servers provided by the platform itself. 

To enable it, head over to Setup → Email → Deliverability. Under the Email Security Compliance (Emails from Salesforce or Email Relay Only) tab, untick the box next to Enable compliance with standard email security mechanisms and Enable Sender ID Compliance. 


![Configuring deliverability settings in Lightning Experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pmtsfw3ihdmges5czzn5.png)


![Configuring deliverability settings in Salesforce Classic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/198qqjjrc5hydzz5pbn2.png)

Add Salesforce’s SPF record in the DNS records of your sending domain. For that, you’ll need access to the DNS control panel or the management console. The particular steps vary depending on your hosting provider so make sure you check their documentation for detailed instructions. Additional Salesforce-specific information is also available [here](https://help.salesforce.com/s/articleView?id=000382664&type=1). 

The final step is to set up Secure DKIM keys. This will ensure better [email deliverability](https://mailtrap.io/blog/email-deliverability/) i.e., [prevent email from going to spam](https://mailtrap.io/blog/salesforce-email-going-to-spam/). 

Go to Setup and type DKIM keys in the quick find box. Click Create New Key. 

![Secure DKIM Keys in Lightning Experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v40xei9ymcrq5pixey4g.png)

![Secure DKIM Keys in Salesforce Classic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mir892amqo4491z64cym.png)

Choose the size of the RSA key. It’s recommended to use 2048-bit for more security, but you can use 1080-bit depending on the email recipients’ limitations. 

Then enter unique values in the Selector and Alternate Selector fields. The latter will allow Salesforce to rotate your keys automatically. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bgpi3qkdq7ip2m23nfza.png)

The instructions on creating a DKIM key can be found here. Alternatively, read our blog post for more information or watch the [video](https://youtu.be/jy6YMzQZTz8). 

Enter the domain name and configure the Domain Match Pattern. The pattern determines at what level the DKIM signature should be matched: domain, subdomain, or both. It should be a comma-separated list. For example, the pattern example.com,*.example.com will match at the domain and subdomain level. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6gtvxmp7xuis6gbd0zaf.png)

Click Save. At this point, Salesforce will publish your TXT records to DNS. Publication may take some time. Once it’s complete, you’ll be able to see your CNAME and alternate CNAME on the DKIM Key Details page. 

Publish CNAME and alternate CNAME to your domain’s DNS and activate the DKIM keys from the DKIM Key Details page. 

After that, you’ll be able to send emails from Salesforce Lightning Experience and Salesforce Classic with your own domain. 

### How to send an email from Salesforce with a third-party SMTP server and Email Relay 

Salesforce also has an [Email](https://mailtrap.io/blog/salesforce-email-relay/) [Relay](https://mailtrap.io/blog/salesforce-email-relay/) feature that allows users to route their emails through the desired sending provider’s SMTP server or leverage any other SMTP server. 

Opting for a reliable email service provider (ESP) is a good idea if you want to ensure high deliverability rates and send emails without volume restrictions. This is important whether you’re sending [email marketing](http://mailtrap.io/blog/email-marketing) campaigns, mass emails, or vital transactional emails. 

One such option is [Mailtrap Email Sending](https://mailtrap.io/email-sending/) – an infrastructure with high deliverability rates offering both SMTP and Email API services. Thanks to its smooth SMTP integration, you can easily add it to your Salesforce platform. 

Of course, you’ll need to create an account to get started. Go to the sign-up page and follow the simple steps to register and add your domain. More instructions are available in the Getting Started Guide. 

Note: You should verify your domain to start sending emails. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2qs6pcn4ebzlne27tvs.png)

Once your Email Sending account is up and running, go to the Sending Domains tab and click on your domain. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7vjdsrooies2twr6z42e.png)

Navigate to the API and SMTP tab and select SMTP to reveal your SMTP credentials. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/outujqz3p7dd5m7s69zx.png)

Now return to Salesforce and go to Setup  → Email (under Administration) → Email Delivery Settings → Email Relays.

![Email Relay in Lightning Experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ppnyekz6soe2aqn9oc9e.png)

![Email Relay in Salesforce Classic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lryqtbvqvbjywfkrpnfn.png)

Click Create Email Relay and fill out the empty fields with Email Sending’s SMTP credentials as shown in the screenshot below: 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dx3nua4jp1kq5m89flil.png)

Tick the box next to Enable SMTP Auth, choose the authentication method (plain or login), and enter your SMTP username and password. Click Save. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/imbnbkr4m256apsmwebl.png)

Then, navigate to Email Domain Filters and press Create Email Domain Filter, otherwise your relay won’t be activated. 

![Email Domain Filter in Lightning Experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cov1kttdzfxxl3fsybrz.png)

![Email Domain Filter in Salesforce Classic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o0ew640hxfb17wl3krec.png)

In the Sender Domain and Recipient Domain fields, enter ‘*’ as the default wildcard. Tick the box next to Active and click Save. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/414pwh8rqwp3713ebl96.png)

Now you can send emails with Mailtrap Email Sending’s SMTP server. In the email-sending options in the following sections, we’ll be using Mailtrap’s configuration. 

After sending a test email, click Verify Setup in the API and SMTP tab in Email Sending and you’ll be all set. Then, analyze the performance of your emails with the Actionable Analytics feature with stats for categories and mailbox providers. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kbiegr95m75axckdr3ld.png)

## How to send different emails in Salesforce Lightning Experience 

In Lightning Experience, you have multiple options to send emails depending on your usage of the platform, including sending emails from a record, using merge fields with email templates, adding attachments, and sending emails from action. Let’s go over each use case. 

### Sending an email from a Salesforce record 

Lightning Experience enables you to send emails directly from the record you’re on. You can use this option to contact existing customers or anyone in your system who has a valid email address. With this method, you can send rich or plain text emails using email templates or by compiling them manually. It’s also possible to add attachments, images, and links. 

To get started, navigate to the record you want to send an email from. This can be an account, contact, lead, opportunity, case, or even a custom object.  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bz9g3kbsxydizj4bopuw.png)

Open the record and locate Email in the Activity tab. Press a downward arrow to choose email-sending options (Gmail or Outlook) or click on the Email button directly if your configurations are already set. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o6aljrw0qscgzlvxj0az.png)

A simple email editor will pop up. Insert a Lightning email template or create a custom email message. You’ll find more information about available templates and instructions on using email template builder here. 

To verify the details of the contact or account, you can scroll the record page without closing the editor. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7g38lobwz2i54oqef17n.png)

If you decide to use templates, add attachments or images, preview the email before sending it. That way, you’ll verify merge fields and ensure everything looks as expected. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mzxzp07p9ei6ywp80exh.png)

Once you’re done compiling the email, click Send. If you have Automatic Bcc enabled in My Email Settings, you’ll immediately receive a copy of the message to the indicated return address. The email log will also appear in the Activity tab of the record you sent an email to and in the related records (such as an account, for example). 

To track the engagement (email open and click rates, conversions, bounce rates, etc.) and analyze the results of your campaigns, you should enable email tracking in your org. Go to Setup → Activity Settings and mark the checkbox next to Enable Email Tracking. Save the settings and you’ll be good to go. Read our [dedicated blog post](https://mailtrap.io/blog/salesforce-email-tracking/) for more information on email tracking options in various Salesforce editions. 

### Sending emails from Email Quick Actions 

Salesforce Lightning Experience streamlines the email-sending process for sales reps with the help of email quick actions. These allow you to create custom actions, predefine fields, and send emails without having to fill out field values manually. 

If you don’t have email action, you can create it using the instructions below. If you already have one, a custom email quick action can be added for a specific account, opportunity, or business event. 

Navigate to Setup → Global Actions and click the New Action button. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4yrdxubmy8whqhk1uqvb.png)

Choose Send Email as the Action type and Email as the Standard Label Type. Come up with a unique name for the action to avoid errors while executing API calls. Click Save.  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vrmk83spgqqbycstc3y4.png)

A page layout editor window will appear. You can either accept the default configuration or adjust the properties for each field manually. Once you’re done, click Save. 

Go to a record to check if the newly-created quick action is in place. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mo35zpn5c23110w46kl7.png)

To automate processes even more, it’s possible to create predefined field values, such as To, Cc, or Bcc. 

Navigate to Global Actions in Setup once again, open the email action you want to edit, and click New under Predefined Field Values. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xrbamrj36yt0eyipuhi.png)

Select To, Cc, or Bcc in the Field Name dropdown menu. Use the formula editor and JUNCTIONIDLIST function to associate the selected field with a Salesforce record. Click Save. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lthkww8z0l1lpmohegra.png)

Note: JUNCTIONIDLIST is only necessary when using values with multiple IDs. 

That’s it. When you create a new email, the From (filled automatically by Salesforce) and To fields will be automatically defined. Then you can send emails as we did in the previous section.

## How to send emails in Salesforce Classic 

Similar to Lightning Experience, Salesforce Classic also enables you to send a single email message from a particular record. 

Open a specific record such as a contact, account, lead, opportunity, etc., and go to Activity History. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ubndws0vmdp0lbdl7aue.png)

Press the Send an Email button to open the email composer. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a001ph90vzlleyy0xciu.png)

Choose between text and HTML editors and fill in the empty fields. Craft the email content manually or use one of the Salesforce Classic templates. You could also send emails with attachments from here. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bczej4fezpxqvwjwhs69.png)

Click Send and check the email in your inbox if you defined the Bcc field. 

Remember that Email Composer takes note of the opt-outs. If you attempt to send an email to an unsubscribed user, you’ll see a warning message. However, this rule doesn’t apply to Additional To, Cc, and Bcc fields.


Thank you for reading this part of the article! Read full version in Mailtrap blog and discover [how to send email using trigger in salesforce](https://mailtrap.io/blog/salesforce-send-email/)!