Different Ways of Sending Emails from Flow

Different Ways of Sending Emails from Flow

Salesforce Flow is a powerful automation tool that allows users to create custom processes in Salesforce. Among its versatile capabilities, Salesforce Flow actively enables users to send emails, making it one of the most common and impactful actions in the platform. Users can effortlessly send personalized emails by leveraging the platform's intuitive features and seamless integration with email templates and Salesforce data. This enables effective communication with customers, prospects, and stakeholders, ultimately driving business success. Here are different ways of sending emails from flow.

1- Using an Email Alert

Email alert is an email notification that Salesforce sends to specific recipients when a particular event happens in the system. In order to create an email alert, you have to create an email template first. Then in the email alert, you have to select the related object, email template, recipients, and the from email address.

Email Alert

In order to use an existing email alert in your flow, add the 'Send Email Alert' action or search for the name of the email alert.

Send Email Alert Action for Sending Emails

Then, all you need to do is to provide the record Id. If the email alert is using merge fields, this record will be the starting point for those merge fields.

Send Email Alert Action

Since all the information (subject, body, recipients, sender) will come from the email alert, there is nothing else you need to do in the flow.

2- Using the Send Email Core Action

The second way of sending emails is using the 'Send Email' core action.

Add an action element to your flow and search for 'Send Email'. Then set input values for the action.

Send Email Core Action

There are two options available in this action. First option is to compose an email directly in the flow. The second option is to use an existing email template.

Input Values

  • Body: This is the body of the email. It is required if you are not using an email template. It is possible to type a text or create a text template (rich or plain text) and provide it as a resource.
  • Email Template ID: This is the Id of the Classic or Lightning email template to use for the email subject and body.
  • Log Email on Send: It is a boolean that indicates whether to log the email on the specified records’ activity timelines and activity history. To log an email, you must specify a value for Recipient Id, Related Record Id, or both.
  • Recipient Address Collection: This is a text collection of the recipients' email addresses. It is possible to enter a value for Recipient Id, Recipient Address List, and Recipient Address Collection as long as the total number of email addresses is five or fewer.
  • Recipient Address List: This is a comma-delimited list of the recipients' email addresses.
  • Recipient ID: This is the Id of a lead, contact, or person account record. You must provide a value if you are using an Email Template. If Log Email on Send is true, this parameter becomes the Id of the person to send and log the email to. If there is an Email Template Id, this parameter is the Id of the person to send an email to and populate recipient merge fields with. If you enter a Lead Id, you can’t use Related Record Id.
  • Related Record ID: This is the Id of a non-recipient record. For example, the Id of an opportunity record. If there is an email template, this parameter is the Id of the record for populating email template merge fields.
  • Rich-Text-Formatted Body: This is a boolean that indicates whether you want the resource specified for the Body parameter to use rich text.
  • Sender Email Address: It is the organization-wide email address for sending the email. It is required when Sender Type is OrgWideEmailAddress.
  • Sender Type: Type of sender that the email is sent from. Valid values are CurrentUser (default value), DefaultWorkflowUser, and OrgWideEmailAddress.
  • Subject: It is the subject of the email and it is required if you are not using an email template.

Example

Let's compose an email directly in the flow.

Create a text template to use as the email body.

Email Body

Then set input values for the action. Pay attention that since the email body is a rich text, you have to make Rich-Text-Formatted Body true. In this example, the system sends the email from an organization wide email address.

Send Email Action Input Values

Now, let's send an email using the email template from the first example.

Add a Get Records element to get the email template.

Get Email Template for Sending Emails

Then, add the Send Email action and set the input values. Body, subject, and rich-text-formatted body values are not relevant because they will come from the email template.

Sending Emails using Email Template

As you can see, there is an email log on the record. Moreover, it is possible to track email opens.

Log Email on Send

3- Using Custom Actions

Those were the standard ways of sending emails from flow. The 3rd way is using custom actions. Although the standard options are enough for most of the use cases, there are still missing options. For instance, it is not possible to send attachments. However, you can solve this issue using custom flow actions.

Here is a custom flow action called Send Better Email from UnofficialSF.

This action allows you to send attachments using content document link records.

Custom Action for Sending Emails

Moreover, as you can see, it creates an email log and it is possible to track email opens.

Track Email Opens

Which Option Should I Choose?

There are multiple ways of sending emails in flow. Which option to choose depends on what you want to do. First of all, if you want to send attachments, you cannot use the standard options. Therefore, custom flow action is the only option.

If you want to use flow variables and compose an email directly in the flow, or you need full control on the recipients, then you should use the send email action. However, if you just need to trigger an existing email alert, then using Email Alerts would be the best option.

27 Comments

  1. Thanks Yumi. I recently started using Log an Email for Send Email Actions within a flow however my client has some old process builds that send out Quote email reminders so I needed to use the tool to convert them to a flow first. I realised I would need to convert my Email Alerts to Email Actions and thought I would need to re-create all emails as rich text email bodies but your instructions showed I could call the email template already created. My first attempts in debug received an error about not providing the template id but it is because I thought the Developer Name = Email Template Name, it was only after using Salesforce Inspector that I found the actual Developer Name and the flow completed. Thanks again for these instructions because it is good to know I can use existing email templates.

    • Hi Fiona,
      Thanks for your message. As you said, you don't need to build your email templates again. You can use the existing email templates (both classic or lightning). You just need to enter the id of the email template.

    • Of course, you can send the email to any email address that you want. If you are using the Send Email action, you can put the email addresses hardcoded or you can use variables.

      • Hi,
        I want to use the hardcoded email address. But I'm getting error when I added my email in recipient Address list. Where exactly do we need to add the hardcoded value ? Also how to send mail to multiple users

        • What is the error message? You can add multiple email addresses separated by commas to the Recipient Address List parameter.

  2. Thank you Yumi, they were very useful informations, I just didn't find anyway to send email from any custom email fields (for Instance lead onboarding owner is a user lookup field) Is there any way to use this user lookup field email for email sender ? What I see is, there are 3 ways for sender 1 - orgwdefault mail 2- current user 3- workflow defaultuser

    • Hi,
      It is not possible to send on behalf of someone else. Valid options are current user, default workflow user, and org wide email address.

  3. Thank you Yumi, they were very useful informations, I just didn't find anyway to send email from any custom email fields (for Instance lead onboarding owner is a user lookup field) Is there any way to use this user lookup field email for email sender ? What I see is, there are 3 ways for sender 1 - orgwdefault mail 2- current user 3- workflow defaultuser .

    • Hi,
      Those are the only options. It is not possible to send emails from other email addresses (unless you add them as org-wide email addresses).

  4. Hi Yumi,
    My requirement is to send emails to a custom email address stored in a field using an email template. I don't have a Recipient ID(WhoId). I was using option 1 as option 2 is not valid for me.
    But the problem is Send Email alert(option 1) doesn't log any activity history, which I need as part of my requirement.
    Any workaround?

  5. i am not able to get the merge fields from email template in email, i have written flow on custom object. if i use record.id in related id i get the whatid error.

  6. Hi Yumi,

    I created a flow. Send Email Action is triggered but output shows none and the user is not receiving emails. I checked permission set if he has access to the fields, everything is in place. Even email logs show that an email has been received but no emails in his inbox. Could you please tell me what am I missing?

  7. hi Yumi
    Is there any way to send email in flow by Lead.owner email address
    I mean email sent from = lead.owner (user email address)
    ?

    • Hi Can,
      It is not possible. You can send an email from the current user, default workflow user, or organization wide email address.

  8. I am not able to receive the email from send email action.
    using classic email template and when logged on the related record i can see the email being generated. Do you know what could be the possible reason. I am doing this in a sandbox.
    Thanks

    • What is the deliverability of your sandbox? It must be "All email". You can search for deliverability in the setup.
      If it is already set as "All email", can you please check your spam folder?

  9. Is there a way (maybe with Salesforce Inspector or some similar tool) to identify all the Flows which use the "Send Email Core Action" in them?

    We have a department which has decided to change their name, and thus their email address. Using Inspector it's easy enough to find the Email Alerts which send to the old address, but there may be some Flows which are using the Core Action to send emails to that address as well, so I need to find them.

    I don't really expect to be able to automatically locate the Flows which send to this particular address (since the address could be hard-coded, or a variable, or a constant...), but right now it seems I'll have to manually open each and every Flow just to see if it even has a Send Email Core Action in it...

2 Trackbacks / Pingbacks

  1. Preventing Flows From Sending Emails in Sandbox Environments - Salesforce Time
  2. How to Send Email With a Record Table in Flow - Salesforce Time

Leave a Reply

Your email address will not be published.


*