Join us

Salesforce Mass Email – How to Send and Test

for_blue_background-693x360.png

Welcome to our comprehensive guide on Salesforce mass email sending. Whether you’re a tech-savvy professional or someone new to the platform, this article has got you covered. 

We’ll explore various methods and techniques to send mass emails using Salesforce. 

Read on to learn how to send targeted marketing campaigns or important updates to your customers. This article walks you through the process step by step and uncovers various methods and features available to help you reach a large audience effortlessly. 

Note: This article is for existing Salesforce users. It assumes that you’ve already set up Salesforce, so those steps won’t be covered. 

Salesforce mass email limits

Knowing your Salesforce limits helps secure a smooth and efficient emailing experience. Here are the highlights at the time of this writing. 

  1. Daily Mass Email Limit

This limit is there to prevent abuse and maintain high deliverability. And it varies depending on your Salesforce edition and the number of user licenses. 

Note that the ‘daily mass email limit’ described here is the total maximal number of emails you can send per day, across all options and Editions. 

As per Salesforce Help Center, the limit is 5000 emails. And in Apex and API, the limitation is the same.

Make sure to check your specific edition’s limit to ensure you stay within the allowed quota. Note that the highest mass email limit typically applies to the Enterprise Edition. 

  1. Recipient Limit:

The Salesforce recipient limit also depends on your edition and the type of emails. For instance, for the six Editions of Salesforce, the recipient limit ranges from a few dozen to 5,000 recipients per mass email.

To stress, the maximal number is again 5,000 but it pays to touch upon the concept so you can better understand the logic. 

For example, you could send one email to 5,000 recipients, thus exhausting your limit on the highest Editions. Or you could send multiple emails to specific recipient cohorts, to the same effect. For instance, 10 different emails to 500 recipients each. 

Either way, the cap is 5,000 on the highest plan, and you need to carefully plan your campaigns to avoid exhausting the limit too fast. 

Pro Tip: If the same external email address appears under different email marketing lists/campaigns, the address will be counted toward the limitation each time. 

  1. Data Size Limit:

Each email you send has a maximum data size limit, which includes the combined size of the email content, attachments, and merged fields. The limit varies based on your Salesforce edition and ranges from a few MBs to 25 MB.

The max limit is the same in Lightning Experience and Salesforce Classic, but there’s a difference in the number of attachments you can include. 

  • Salesforce Classic – 10+ attachments, not exceeding 25MB
  • Lightning Experience – up to 10 attachments, not exceeding 25MB 
  1. Email Template Limitations

Salesforce caps the number of templates at 500 for all organizations under Trial or Free plans. For more information on Salesforce platform limitations with paid editions, you’ll need to reach out to Salesforce support.

Also, note that organizations using Developer Edition under a trial period can only send up to 10 emails to external email addresses. 

Bonus Tip: Deliverability Considerations

Even though you can send mass emails with Salesforce integration, it’s crucial to maintain good deliverability and avoid practices that may result in your emails being marked as spam. If you want the details, check our blog post – “Email deliverability: everything you need to know”. 

Lastly, the limitations mentioned above could be subject to change, and it’s advisable to refer to the official Salesforce documentation for the most up-to-date information regarding mass email limits.

How to send mass emails in Salesforce?

Here, we’ll talk about sending mass emails in Salesforce Classic, so it’s more geared to legacy users (those who began using Salesforce prior to 2018 but still haven’t switched). However, we also cover Lightning Experience later in the article. 

Note: Make sure to enable mass email with your Salesforce implementation. If that’s not done, you’re likely to get a message similar to the one below. 

Create a mass mailing list of Contacts or Leads

  1. Navigate to Contacts or Leads

Click the Contacts or Leads tab, depending on the type of recipients you want to include in your mass email.

Source: Salesforce support

Scroll down to the Tools section, and click Mass Email Contacts

Source: Salesforce support

2. Follow the Mass Email tool wizard

After clicking Mass Email Contacts, you enter a four-step process to set up and customize your mass email campaigns. 

Source: Salesforce support

First, you need to choose the recipients for the campaign. Then, choose a View from the drop-down menu, or click Create New View. For the purposes of this tutorial, we’ll choose the latter. 

Source: Salesforce support

Next, add the View name, and use filters, such as specific fields, campaign membership, or custom criteria, to narrow down your target audience.

Make sure to leverage specific Salesforce customization options and select filters and criteria only for the mass email leads you’d like to contact. 

Salesforce offers quite a few filtration options and allows you to choose fields to display and filter by specific fields. That allows you to create a mass email list, zeroing in only on the user cohort you wish to contact. 

Also, you can change the visibility of your campaign under Step

Source: Salesforce support

3. Save the Mailing List:

Once you have defined your criteria, save the mailing list. Upon clicking the button, you’ll see the filtered list of recipients. You can add or remove recipients by checking or unchecking the box in front of their names. 

Reminder: The number of recipients per single email varies based on the Salesforce edition you use. 

4. Choose an email template

After saving the list, you move to Step 2 of Mass Email with Salesforce. Here, you choose the email template. Keep in mind that you can’t create a new template at this step. 

Source: Salesforce support

5. Confirm your choice and send

Step 3 gives you the option to BCC an email copy to yourself, you can create a custom Mass Email Name, and send it immediately, or schedule the campaign. 

A scheduled email has a “pending” status until sent, and you can cancel it anytime prior to the due date/time. 

Source: Salesforce support

Should you choose to hit the Send button, your email gets sent immediately, and you’ll get the confirmation window. 

Source: Salesforce support

6. Check status and manage

To see the status of your emails and manage campaigns, you need to do the following. 

  1. Click your account name in the upper right section and choose My Settings
  2. Select Email in the side menu, then click Mass Email

Source: Salesforce support

3. Check the list of all your campaigns per the selected View.  This is also where you can cancel pending campaigns.

Sending bulk emails in Lightning Experience

Overall, the processes and functionalities are mostly consistent across Salesforce Classic and its revamped sibling. Though, we should stress that Salesforce Lightning is more feature-rich, particularly in the area of data management, analytics, and marketing automation. And sending bulk emails in Lightning Experience is faster and more user-friendly.

However, we won’t focus on features comparison here. Instead, we’ll show you the most effective way to send mass emails and highlight any significant differences, if necessary. 

  1. Create an email template

Click the App Launcher (nine colorful dots) in the upper left corner of the screen, type ‘Email Templates’, and hit enter.  

Source: Salesforce Support YouTube

Click the New Email Template button, and create your template. Make sure to include the subject, message body, and any merge fields or templates you wish to utilize, then Save it. 

Source: Salesforce Support YouTube

Note: You don’t have to start by creating a template, you can do it later, or select one of the existing templates. 

2. Navigate to Send List Email

In Lightning Experience, the feature is actually called Send List Email, instead of Mass Email. And it appears under the Contacts, Leads, or Campaign Member view. And the steps are largely the same regardless of the method you choose. 

Source: Salesforce Support YouTube

Click Send List Email and, under New List View, type List Name and List API Name into the designated fields. Then, choose ‘view permissions’ and click Save

3. Select the Recipients

Hover over the Filter by Owner box and choose the contacts to send bulk email to. 

Source: Salesforce Support YouTube

Proceed to Add Filter and segment your recipients based on the given Field, Operator, and Value criteria.

Source: Salesforce Support YouTube

Depending on your requirements, you can opt to send the email to specific campaign members, contacts, or leads from a report, or custom lists. Plus, you can use the Add Filter Logic option to give your list another dimension. 

4. Review and Send

Before sending the email, take a moment to review the recipient list, email content, and any attached files. Ensure everything is accurate and aligns with your intended communication. 

Afterward, click the Send List Email button, then the Insert, create, or update template icon. Insert the template you created in the first step; here you can also add merged fields by clicking on the ‘braces’ icon. 

Source: Salesforce Support YouTube

Once you confirm all’s well and you’re sending to the right recipients, hit Send, and your campaign will be deployed. 

How to send mass email through Batch Apex in Salesforce

In addition to the built-in Mass Email or Send List Email functionality, Salesforce provides Apex, a versatile object-oriented language, similar to Java. 

By leveraging Apex, you can automate the process of sending bulk emails, enabling you to handle larger volumes of email communications. 

Let’s explore how you can send mass emails through Apex in Salesforce.

  1. Import statements and create an Apex class:

Begin by importing statements and creating an Apex class that implements the ‘Batchable’ interface. This class will define the logic and behavior for sending the mass email.

Here are the import statements. 

Note: Importing Database and Messaging is optional. 

And you define the class using the following line. 

This declares a class named MassEmailBatch that implements the Database.Batchable<sObject> interface. It signifies that this class can be used as a batch job for processing records.

2. Implement the Start, Execute, and Finish Methods

In the Apex class, implement the Start method, which retrieves the collection of records to process (your recipients, in this particular case). This can be based on criteria or queries.

To stress, the start method is required for a batch job and specifies the initial step of the batch process. It returns a Database.QueryLocator object that defines the records to be processed. 

In this case, the method queries the Contact records based on specific criteria and returns a query locator for those records.

Reminder: Don’t forget to specify the criteria under <your_criteria_here>

That out of the way, you can implement the Execute method, where the script iterates through the collection of records and constructs personalized email messages using Apex Email Messaging classes.

This is where the actual record processing takes place. The script receives a batch of records (a scope) to process. In our example, it iterates through each record and constructs a personalized email message using the Messaging.SingleEmailMessage class. 

The script then sets the email subject, plain text body, and recipient’s email address based on the record’s data.

The constructed email messages are added to the email list. After all the records are processed, the Messaging.sendEmail method is used to send the batch of email messages. The Messaging.SendEmailResult array contains the results of the email-sending operation, which are then processed to check for any errors or exceptions.

Lastly, you’ll need to implement the Finish method, which handles any necessary cleanup tasks or post-processing actions.

For your reference, here’s the full script. 

3. Send with email template

Create and customize the template according to your needs and include any merge fields as required. You can do all that within the Salesforce interface, but make sure to save the template ID to reference it in the code.  

Now, we’d need to rework the ‘execute’ method so it references a template, here’s the snippet. 

Here’s what we did:

  1. Added the line email.setTemplateId('<your_template_id_here>'); to set the ID of the email template you want to use. Replace <your_template_id_here> with the actual ID of your email template.
  2. Added the line email.setTargetObjectId((Id) record.get('Id')); to set the ID of the recipient object. This can be the ID of the contact, lead, or user to whom you want to send the email.

Check the full reworked script. 

4. Schedule and execute an Apex batch

To schedule and execute a batch, and then send mass email from custom object, we’ll need to go back to the script above and add yet another layer of functionality. 

With these additions, the class now implements the ‘Schedulable’ interface, allowing you to schedule and execute the batch job using the Salesforce scheduler. The execute() method from the ‘Schedulable’ interface is implemented, where you create an instance of the batch class and call Database.executeBatch() to schedule the batch job.

Thereon, you can use the System.schedule() method in Salesforce to schedule the execution of the MassEmailBatch class based on your desired schedule. For example:

In the above example, the MassEmailBatch class is scheduled to run on January 1, 2024. You can modify the scheduleExpression to define your desired schedule.

Make sure to adjust the schedule expression and any other parameters to fit your specific requirements.

5. Monitor the Progress and Results

Keep an eye on the progress of the Batch Apex job by reviewing the Apex job queue or monitoring logs.

Once the job completes, analyze the results and track any errors or exceptions for troubleshooting purposes.

Remember to ensure that your Apex implementation adheres to Salesforce’s best practices, follows email regulations and permissions, and respects the privacy and preferences of your recipients.

And if you need more information on sending emails using Apex, check our “In-Depth Gide on Sending Emails With Apex”. 

How to test emails before sending them?

There are two options to test emails in Salesforce – use Apex test class, which we cover in a separate article. Or you could use a third-party tool such as Mailtrap. 

But why third-party tools when there’s an Apex test class? 

Well, the Apex class test results are one-dimensional, and only check the code functionality. But besides testing the functionality, you’ll also want to:

  1. Determine how much different mailbox providers support your HTML and CSS templates. 
  2. Check the spam score in sandbox. 
  3. Debug an email notification in staging without risking your sender’s reputation. 
  4. Fully automate test flows and scenarios.
  5. Minimize the chance to experience a lot of bounces. 

Without much further ado, we’ll jump right into the methods. And note that we assume that you already have a Mailtrap account. 

Tip: You don’t have to add and verify a domain to test emails. This doesn’t apply to Mailtrap Email Sending.  

SMTP Method

  1. Get your Mailtrap SMTP credentials

Once inside Mailtrap, click Email Testing in the menu on the left, then the inbox you’d like to use under Inboxes

Under SMTP settings click “Show Credentials” to reveal them. 

2. Configure an email relay

Navigate to the Email Relays menu by typing ‘relays’ into the search box. Generally, the Email Relays menu is under Setup. 

Source: Salesforce Support YouTube

Then, click the Create Email Relay button, and copy-paste the credentials provided by Mailtrap. 

Source: Salesforce Support YouTube

Make sure to tick the box next to Enable SMTP Auth, and use the credentials provided by Mailtrap. Also, keep the box next to Change Password unchecked. 

3. Save and set up filters

Click the Save button, but note that your relay still isn’t active. Under Email Relays, click the “filters for recipients and sender domains” link. Then, proceed to create a fliter. 

Source: Salesforce Support YouTube

4. Email Domain Filters configuration

Upon creating a filter, the default configuration is to send emails to all user domains from all sender domains. Of course, for testing purposes, you should choose the Mailtrap Testing SMTP relay, you just created from the Email Relay dropdown. 

Source: Salesforce Support YouTube

Save the filter, and proceed to use the flowing script to send test emails. 

Now, this is only one of the ways you can test Salesforce emails with Mailtrap. If you want to dive deeper into all available methods and workflows, check our comprehensive guide on “How to Test Emails in Salesforce with Mailtrap Email Testing”. 

Sending with 3rd party email providers: why and how?

As we already covered sending emails natively with Salesforce, this section focuses on third-party email providers. We cover the reasons to use third-party providers, as well as some downsides to keep in mind. 

Also, the exemplary integration is geared toward Mailtrap users. For now, you’ll only be able to send transactional emails – our bulk email feature is currently under development. 

Be that as it may, Mailtrap and Salesforce make a killer marketing tool. They allow you to seamlessly merge the CRM and email solutions and take the sales in your company to the next level. 

The Whys

When it comes to sending emails from Salesforce, you have a couple of options. You can use Salesforce’s built-in email services, or you can use a third-party email service provider. 

While Salesforce’s built-in services are convenient, there are several compelling reasons to consider using a third-party service:

  • Deliverability: Third-party email service providers such as Mailtrap specialize in email deliverability. They have dedicated teams and technologies to ensure your emails reach the recipient’s inbox and not their spam folder.
  • Scalability: If you’re sending at a volume, third-party services are designed to handle and balance that load. Salesforce has daily limits on the number of emails you can send, which can be a constraint for some businesses.
  • Features: Third-party services often come with additional features such as email templates, analytics, A/B testing, automation, and more. These can be valuable tools for optimizing your email campaigns.
  • Cost-effectiveness: Depending on your volume of emails and the specific features you need, third-party services can often be a more cost-effective solution.

However, there are also some potential downsides to consider:

  • Integration: You’ll need to integrate the third-party service with Salesforce, which can require some technical setup. But at Mailtrap, we ensured the integration process is as smooth as possible. 
  • Dependency: You’re relying on another service, which could potentially have its own downtime or issues.
  • Cost: While often cost-effective, there is still a cost associated with third-party services. You’ll need to evaluate this against your budget and needs.

The How 

As a reminder, the quick tutorial below is geared toward transactional emails that you can send at scale with Mailtrap. 

Also, unlike Mailtrap Testing, Mailtrap Sending requires you to add and verify a domain. And, in the sections below, we assume you already did it.  

If you need any help adding or verifying your domain, check our Getting Started Guide. Or watch our Domain Setup Video. 

  1. Add Email Relay

To start sending transactional emails via Mailtrap Sending, you need to set up another Email Relay. The steps are pretty much the same as previously described under the Testing tutorial. So, we won’t go into details here, only pay attention to the number of relays you can add as per your Salesforce Edition. 

Also, keep in mind that, of course, we have somewhat different credentials for Testing and Sending. Take the following path to get to them. 

Sending Domains > Choose a domain > SMTP/API Settings

2. Send test email

To stress, the ‘test email’ you’ll be sending is there to confirm your configuration. By default, the ‘test email’ gets sent to the email address you use to sing into Mailtrap. 

Here’s the code snippet to send a test email. 

And here’s the addition to include a string from a List. 

Mass Send to the Rescue

We’ve covered a lot of ground in this article, diving deep into the process of Salesforce mass email sending. From Apex to testing, and the nuances of Salesforce Classic and Lightning Experience, we’ve seen that Salesforce offers a range of powerful tools for mass emailing.

As we wrap up our exploration of sending mass emails in Salesforce, keep in mind that each method has its own strengths and considerations. We hope this guide shed some light on these processes and will serve as a stepping stone for your future endeavors in Salesforce. 

Remember, the world of Salesforce is vast and ever-evolving, so keep exploring, keep learning, and most importantly, keep emailing!

Thank you for reading this article! Find more about how to send mass email from salesforce lightning in Mailtrap blog!


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!

Avatar

Veljko Ristic

Content Manager, Mailtrap

@veljkoristic
Linguist by trade, digital marketer at heart, I’m a Content Manager who’s been in the online space for 10+ years.
User Popularity
67

Influence

7k

Total Hits

14

Posts