Send Rich Email (Send HTML Email Action)

Note: There’s a version of this action that uses a Custom Property Editor to provide a more usable configuration experience. It requires a Spring ’20 Org that has been activated for the Custom Property Editor Pilot. Learn more here.

Video introduction

Installation (See bottom of page)

Source code

Flow provides a built-in Send Email action but it’s something of an underachiever. The sendHTMLEmail action uses the power of Apex and Flow Actions, easily installed and used from within Flow Builder. MVP Jeremiah Dohn pioneered this space several years back with his well received HTML Email Flow action. The version here is similar and adds a several of additional capabilities.

This improved email flow action supports:

  • Rich, HTML email bodies that can use all of the capabilities of Flow’s Text Templates, including Bold, Italics, Underline, Bullets and Numbers, Left/Center/Right justification, URLs, images, fonts, and text size
  • Email Templates (both Classic and Lightning) with field merge and letterheads
  • Any combination of the following, for To, CC, and BCC
    • A single email address
    • A string collection of email addresses
    • A collection of Contacts
    • A collection of Users
    • A collection of Leads
  • Organization-Wide Email Addresses
  • Attachments
  • Ability to toggle on/off the use of the Salesforce per-user email signature
  • Ability to provide a plain text body, an html body, or both
  • Ability to set the ReplyTo email address and the Sender Display Name
  • Multi-Language Support for Lightning Email Templates

Each email requires several components, but they may be constructed in many ways using the component parameters. The package includes a flow that produces emails in several scenarios. See Examples below.

Currently unsupported features include:

  • Support for the MassEmailMessage API, enabling higher volumes
  • Character Set setting

NOTE: Scratch orgs have a strict cutoff after sending just 50 email messages

If you’re interested in extending this class, please do so!


There are many configurable options for this Action Component. Decide what and how your email needs to communicate, then choose the best combination to provide the needed communication.

Addresses (To, CC, BCC)

You can generate addresses from any of the following sources:

  • A single email address
  • A string collection of email addresses
  • A collection of Contacts
  • A collection of Users
  • A collection of Leads

Example: Create a collection variable of strings and add individual email addresses to it:

Add a collection variable
Populate the collection variable
// for a string
String exampleSingleEmailAddress = "";
// or for collections
List<String> exampleStringCollection = new List<String>{"",""};
List<Contact> exampleContactCollection = [SELECT Id Contact Limit 2];

Example: configure inputs with sources of email addresses:


Addressees are manually assigned using the following parameters (Type List<> is a Collection):

Name Type
SendTOthisStringCollectionOfEmailAddressesList<String> (or Collection of String in Flow)
SendTOtheEmailAddressesFromThisCollectionOfContactsList<Contact> (or Collection of Contact in Flow)
SendTOtheEmailAddressesFromThisCollectionOfUsersList<User> (or Collection of User in Flow)
SendTOtheEmailAddressesFromThisCollectionOfLeadsList<Lead> (or Collection of Lead in Flow)
SendCCthisStringCollectionOfEmailAddressesList<String> (or Collection of String in Flow)
SendCCtheEmailAddressesFromThisCollectionOfContactsList<Contact> (or Collection of Contact in Flow)
SendCCtheEmailAddressesFromThisCollectionOfUsersList<Lead> (or Collection of Lead in Flow)
SendBCCthisOneEmailAddressString (or Collection of String in Flow)
SendBCCthisStringCollectionOfEmailAddressesList<String> (or Collection of String in Flow)
SendBCCtheEmailAddressesFromThisCollectionOfContactsList<Contact> (or Collection of Contact in Flow)
SendBCCtheEmailAddressesFromThisCollectionOfUsersList<User> (or Collection of User in Flow)
SendBCCtheEmailAddressesFromThisCollectionOfLeadsList<Lead> (or Collection of Lead in Flow)

Sender (From)/Reply-To

These seetings determine what addresses the email will appear to be coming from. NOTE: Unless you’ve made special arrangements in your Org, the message will always appear to be coming from (Example):; on behalf of; Do Not Reply <> .

You can either 1) use an OrganizationWideEmailAddress or 2) specify your own Reply-To Email Address and Sender Display Name. If you provide an OrganizationWideEmailAddress, that will take precedence and any Reply-To Email Address and/or Sender Display Name you’ve also provided will be ignored.

Using Organization-Wide Email Address

To use an OrganizationWideEmailAddress , pass the Id of one that you have defined into the action via the “Use This Organization-Wide Email Address Id”. (If you want to get the benefit of Verified sending, you can’t just paste the email address into the Reply-To Email Address field. You have to use the Use This Organization-Wide Email Address Id field.). to find the ID, search the OrgWideEmailAddress object for the appropriate Id. NOTE: you cannot use OrganizationWideEmailAddress and

  1. In Lightning Setup, go to Organization-Wide Addresses and click Edit on the address you want to use:

2. Examine the URL of this web page. It should look something like this:

3. The Id of the Organization-Wide Email Address is the character between the 2 “%2F” strings. So in the example above, you would extract “0D2560000008PGP” and insert it as an input:

Using Custom Reply-To and/or Sender Display Name

You can change both the “Reply-To” (using the “replyEmailAddress” attribute) and how you wish that name to be displayed (using the senderDisplayName attribute).

The optional In-Reply-To field of the outgoing email identifies the email or emails to which this email is a reply (parent emails) , and the name that appears on the From line of the email. The display name cannot be set if the object associated with a setOrgWideEmailAddressId has defined its DisplayName field.


Subject can be set directly via the subject parameter. Note that if you choose to use an Email Template Id, the subject will be specified in the template, and the subject parameter in this action will be ignored. Don’t try to use both at the same time. See below for more information on using email templates.

NOTE: If you specify Subject when using an Email Template, that value will override the Template’s Specified Subject. Emails without a subject (either specified or part of the template) will not be sent/delivered.


To specify the body of the email, you can use any of these combinations :

  1. HTML Body. The body is composed using a text (or rich text) variable, then passed to the Action in the HTMLbody parameter. Flow variables and Global variables can be included for merge in the text at the time of invocation using the standard merge syntax (e.g., {!stringCollectionEmailAddresses} ). You cannot use HTMLBody and a template.
    1. Advantages. Very quick to create, assemble, and test.
    2. Disadvantages. May be difficult to find and might require developer (as opposed to Administrator) support to modify. Also, can be very tricky using multi-linguistic sites. (Hint: USE LABELS!!)
  2. Plain Text Body. Even when you’re sending out an HTML email, a plain text alternative can be desirable. Multi-part MIME (Multipurpose Internet Mail Extensions) bundles together a simplified plain-text version of your email along with the HTML version of your email. You cannot use plainTextBody and a template.
  3. Both an HTML Body and a plain text body. Use this to send out and HTML email with a bundled plaint-text version. You cannot combine this option with a template.
  4. Email Templates (Classic or Lightning Email Template). Use Email Templates to save time and standardize email sent by you or others in your organization. Use merge fields or enhanced letterhead if you need them. This has been an evolving function within SalesForce, so if you are unfamiliar with email template options, you may want to review this. Details on how to use EmailTemplates in multilingual environments can be found here.
    1. Advantages. Consolidates standard communications within the SalesForce email structure (both Classic and Lightning). If you’re using Lightning Email Templates, you have the full range of public, private, and specified sharing capabilities for who can use what and it helps enforce communication standards by making the development of templates and communication more of a communication and policy role rather than a developer or administrator role.
    2. Disadvantages. Users need to understand the concept of templates and sometimes the differentiation between Classic, Lightning, and (sometimes) VisualForce templates.
  5. Multi-Lingual Email Templates (only tested with Lightning EmailTemplates).

Body – HTML Body

Rich Text HTML email bodies can use all of the capabilities of Flow’s Text Templates, including Bold, Italics, Underline, Bullets and Numbers, Left/Center/Right justification, URLs, images, fonts, and text size.

To send a rich text (HTML) body, create a resource of type “Text Template” and specify that resource when sending the email with the sendHTMLEmail action.

Text Template Resource named “HTMLTextTemplate”
HTMLbody Parameter in sendHTMLEmail Action

Body – Plain Text

Even when you’re sending out an HTML email, a plain text alternative can be desirable. Multi-part MIME (Multipurpose Internet Mail Extensions) bundles together a simplified plain-text version of your email along with the HTML version of your email. You cannot use plainTextBody and a template.

To send a plain body text:

  1. [Optional] Create a text resource, either variable or a formula if you wish to insert line breaks:
  2. You can just enter text, or specify the resource in the action input values.

Body – Both an HTML Body and a plain text body

[RFU] Previous versions of SalesForce allowed for templates which automatically attached text-only versions in the event a recipient did not desire and/or have the capability to use HTML-based email. As of this writing, it appears the Lightning Email always sends the HTMLBody, but does not attach the plainTextBody.


You can decide whether or not to include the User email signature if the context user has one configured. The default is true, meaning if the user has a signature it is included in the email unless you specify false. Note: You must enable this parameter AND set it to $GlobalConstant.false if you want to shut it off.


You can attach files to your emails. Provide a collection of ContentDocmentLink records. To learn how to attach documents using CDLs, see more here.

Using Email Templates

For a nice introduction on how to use email templates, letterheads and even graphics, you may wish to start here: Configure an Email Letterhead and Template.

You can use Email Templates with this Action.

There are 3 core concepts:

  1. The Template. The template contains the format of the email (including Letterhead) and syntax for merging fields into that communication. A merge field is a placeholder in an email template or letterhead. When you send the email, the placeholder is replaced with the Salesforce data from the record or records of the people you are emailing. Fields that can be merged include those from the TargetObject, another sObject record, and global variables. NOTE: the merging done by the template system is different from the merging done by Flow, and there is currently limited ability to pass dynamic values from Flow into the template system. HOWEVER, see this post for an easy technique that will allow you to get full rich dynamic merging.
  2. The Target Object Record. This is who the email is being sent to, usually a Contact, User, Lead or Group. Depending on the type of template you are using, other fields from this Target Object can also be merged into the template as part of the send email (e.g., Dear Dear {{{Recipient.Name}}}). In templates, the merge fields for “recipient” come from the specified object Id.
  3. The Related Record. If you specify a contact for the Target Object  field, you can specify an optional Related Record  to merge fields in the template from that record. For the most predictable results, Use the Handlebars Merge Language in Lightning Email Templates and Enhanced Letterhead which merges fields from the record into the email using the format {{{[Related Record Type].[Field]}}} (e.g.,  {{{Case.CaseNumber}}}) and convert your Classic Templates to LightningEmailTemplates with Enhanced Letterhead.

Using Email Templates

For a standard template, the Template ID and the Template Target Record Id (Recipient) are required. Optionally a related record can be specified using the Template/Activity RecordId(whatId/recordId) Input Value.

Adding Multilingual Email Template Support

SendHTMLEmail provides multi-lingual support within the same flow by allowing a set of related email templates to be created in different languages. In the flow, specify the desired language. To make this work, the names of the email templates must follow some rules:

  • Each language localization has its own template with all localizations sharing a common EmailTemplate.Name.
  • To differentiate the localizations, add the following text to the EmailTemplate’s Description fieldt: ‘Language=”en_US”‘ (or whatever corresponding to your organization localizations).

For more on how to add localization to an email template set, please refer to Send HTML Email with Multi-Language Support for Lightning Email Templates.

Saving Activity History

You can record the sending of an email as a record activity. This is based on setSaveAsActivity(saveAsActivity) and is Optional. The default value is true. If this is set, you must also specify a valid Related Record ID(recordID) for where the email activity should be saved. This argument only applies if the recipient list is based on targetObjectId or targetObjectIds. If HTML email tracking is enabled for the organization, you will be able to track open rates.

Operational Considerations

This action makes use of the standard Salesforce email infrastructure, the same service that you use when you send a single email directly from a lightning experience page or a classic case feed. As such, any emails you send will be included in your usage, so be aware of the limits and guidelines. (Developer note: this action makes use of the Apex Messaging service API’s.)

This action does not use or involve Email Alerts, which are used in Workflow Rules and exist in Flow as separate actions you can drag into your flow. Be mindful of this so you don’t accidentally confuse the Email Alerts, the Email Templates, and the Flow Text Templates.


The sendHTMLEmail package ships with two screen flows that can be used to test and demonstrate the action, ‘Send HTML Email Testflow’ and ‘sendHTMLEmail Test – Create Test Templates if Needed’. You do not have to activate these flows to use them. Open ‘Send HTML Email Testflow’ then select “Debug” (or “Run”).

Some of these examples may require prior setup of records. Where necessary, this is described in each of the selected examples. Examples/Tests include:

  1. Simple Email Text – with To, Sender, Reply-To, Subject, Body (All text)
  2. Simple Email with Address Collections – Using Address Collections to Send to Multiple Recipients
  3. Email with Attachments – Simple Email (1) With Attachments
  4. Email Using Template – An email using a Lightning EmailTemplate
  5. Multi-Lingual Using Email Templates – An email using a Lightning EmailTemplate selected by language

Choose the example you would like to see and the instructions are in each of the examples. You will also find in these examples the use of Text Templates for formatted Rich Text messages (Example 1), using Plain Text (Example 2), and logging the email as an activity on the related object (Example 5).

Select Test Flow and Start an example

To see how the Send HTML Email Action is configured for each of these examples, click on the appropriate Action (they are labeled) and look at the Input Variables. You may also want to look at some of the logic in the setup to those examples for ideas in creating your own flows.

Example 1 – Simple Email Text – with To, Sender, Reply-To, Subject, Body (All text)

This sends out a rich text email predefined as a text template () l to the addressee in [Recipient Email Address] from [ReplyTo Email Address] with the name [Sender Name] using [Subject] and [Body]

All of the above can be created by assigning variables. To create a body with line breaks, use a formula variable (see example variable testPlainTextLineFeeds)

Note: To get the full effect of rich text, edit the formula plainTextBody instead of modifying the field on this screen.

Example 2 – Simple Email with Address Collections

This sends out a simple plaintext email from [ReplyTo Email Address] with the name [Sender Name] using [Subject] and [Body]

All of the above can be created by assigning variables. To create a body with line breaks, use a formula variable (see example variable testPlainTextLineFeeds)

The addressees can be built from multiple collections. This example builds a collection of strings from the two email strings and/or from collections you can set up external to the example flow by creating contacts with names containing the text entered in [Contact Contains Match].

By default, this example builds a collection of strings from the two recipient email addresses and will send all collections to To, CC, and BCC (so 6 emails will be sent – minimum)

Example: Create two contacts with valid email addresses and names containing “testContact”, then specify “testContact” in [Contact Contains Match]

Note: To get the full effect of rich text, edit the formula plainTextBody instead of modifying the field on this screen.

Example 3 – Simple Email with Address Collections

For this example, you will need to create or use a record to which attachments can be made (e.g., a Contact). Create the record and then use the recordId of that record to attach files.

This sends out a simple plaintext email with attachments from uploaded files to the addressee in [Recipient Email Address] from [ReplyTo Email Address] with the name [Sender Name] using [Subject] and [Body]

All of the above can be created by assigning variables. To create a body with line breaks, use a formula variable (see example variable testPlainTextLineFeeds)

Note: This example as distributed uses the formula variable “testPlainTextLineFeeds” to create a plain text body without signature

Example 4 – Email Using Template

This sends out an email using a specified EmailTemplate with the addressee specified through the TargetObjectId and optionally (dependent on your Template) merge fields with an associated object record using that record’s Id.

For this example, you will need to create or use a template. Templates also require that you have a recipient record (targetObjectId) (e.g., Contact, User, . . .) which must also pre-exist. You will be required enter the ID for that record as the (targetObjectId). Additionally if you intend to test merge fields (RelatedTo) with your template, you must also pre-create the related object record and have available the Id for that record as an ID for the Record Object Id (RecordId).

This example also creates an activity for the email which will be assigned to the running user and related to the RecordId.

You can create test templates (sendHTMLEmailTest) by running example 5.

If you use the default test templates (sendHTMLEmailTest) the Target ID should be a ContactId and the Related Record should be an AccountID.

Example 5 – Multi-Lingual Using Email Templates

SendHTMLEmail provides multi-lingual support within the same flow by allowing the language to be specified, then selecting the appropriate template for that language. For this functionality, each language localization has its own template with all localizations sharing a common EmailTemplate.Name. To differentiate the localizations, add a tag to the EmailTemplate.Description field in the format: ‘Language=”en_US”‘ (or whatever corresponding to your organization localizations)

This example uses the template set sendHTMLTest with english (en_US) and spanish (es_MX) versions. If the templates do not exist, this example will automatically create them for you (sendHTMLEmailTest).

You will also need to:

1) Create a Contact (for Target Object) and have its Id available.

2) Create an Account (for Related Record) and have its Id available.

You can, of course, vary the templates and object records to reflect your organization’s needs.

This sends out an email using a specified EmailTemplate with the addressee specified through the TargetObjectId and optionally (dependent on your Template) merge fields with an associated object record using that record’s Id.

For this example, you will need to create or use one or more templates. Templates also require that you have a recipient record (targetObjectId) (e.g., Contact, User, . . .) which must also pre-exist. You will be required enter the ID for that record as the (targetObjectId). Additionally if you intend to test merge fields (RelatedTo) with your template, you must also pre-create the related object record and have available the Id for that record as an ID for the Record Object Id (RecordId).

If you use the default test templates (sendHTMLEmailTest) the Target ID should be a ContactId and the Related Record should be an AccountID.


Name Or LabelTypeDescription
contentDocumentAttachmentsList<ContentDocumentLink>(or Collection of ContentDocumentLink in Flow)
Related Record ID(whatId/recordId) String If you specify a contact for the targetObjectId field, you can specify an optional whatId as well. This helps to further ensure that merge fields in the template contain the correct data. This is used for merge fields and for associating activities and attachments.
SendBCCtheEmailAddressesFromThisCollectionOfContactsList<Contact>(or Collection of Contact in Flow)
SendBCCtheEmailAddressesFromThisCollectionOfLeadsList<Lead>(or Collection of Lead in Flow)
SendBCCtheEmailAddressesFromThisCollectionOfUsersList<User>(or Collection of User in Flow)
SendBCCthisStringCollectionOfEmailAddressesList<String>(or Collection of String in Flow)
SendCCtheEmailAddressesFromThisCollectionOfContactsList<Contact>(or Collection of Contact in Flow)
SendCCtheEmailAddressesFromThisCollectionOfLeadsList<Lead>(or Collection of Lead in Flow)
SendCCtheEmailAddressesFromThisCollectionOfUsersList<User>(or Collection of User in Flow)
SendCCthisStringCollectionOfEmailAddressesList<String>(or Collection of String in Flow)
SendTOtheEmailAddressesFromThisCollectionOfContactsList<Contact>(or Collection of Contact in Flow)
SendTOtheEmailAddressesFromThisCollectionOfLeadsList<Lead>(or Collection of Lead in Flow)
SendTOtheEmailAddressesFromThisCollectionOfUsersList<User>(or Collection of User in Flow)
SendTOthisStringCollectionOfEmailAddressesList<String>(or Collection of String in Flow)
Template LanguageStringUsed in conjunction with Template Name, Finds templates with the name matching Template Name for ‘Language=”xxx_YY”‘ in the Description.  Template Selection criteria order first found Name with: 1)If empty, Org LanguageLocaleKey 2)Language found in Description 3)First without ‘Language=”‘
Template NameStringUsed in conjunction with Template Language. Finds templates with the name matching Template Name for \’Language=”xxx_YY”\’ in the Description.
Template Target Record IdStringIf you are passing in a template Id, you need to also pass in the Id of context record. It can be a Contact, Lead, or User. It will determine which data gets merged into the template’

Related Actions


Unofficial SF releases generally come in two flavors: Managed and Unmanaged. Unmanaged packages allow you to see and (if necessary) customize the source code for the components, but have the disadvantage that they may not be upgradeable.

If you are having trouble updating/upgrading the component, you may want to look at: Tips & Tricks – Update/Upgrade an Unmanaged Package

WARNING!!!! For Releases after 1.33 (1.33.1 and higher) Email activities will no longer be saved in the Activity stream unless explicitly using saveAsActivity = true. If you wish to use that feature and did not explicitly specify, you will need to edit your existing flows and add the explicit, “true”.

  • 1.33.1 Unmanaged sendHTMLEmail (with Flow Examples/Tests) – Minor update Addresses issues  #308 and #316 to fill in Task Comments and Recipients and improved documentation.
  • 1.33.1 Unmanaged sendHTMLEmail(Without Examples) – Core Component without Examples/Flow Testing (Added documentation, validations)

Old versions

Notify of
Inline Feedbacks
View all comments
Megan Moody

I was able to get this work – awesome! – but the sender comes through as unverified. I’m populating the replyEmailAddress variable with one of our org-wide email addresses. Is it because I’m sending from a sandbox? Will the behavior be different in production? Also, is there any trick to adding images to the text template being used for the HTML body? I added one, but it doesn’t go with the email. Thanks for any tips you can provide!


Amazing to have Lightning Emails available in a flow – thanks. Am I right in saying that this currently doesn’t support custom object merge fields in the template email – can only be merge fields on the contact, user or lead object?


Thanks so much Alex – v helpful

Jack Pond

arvonfoundation, your issue should be solved in version 1.32 of sendHTMLEmail if you use EmailTemplates (lightning). Make sure you use RecordId (WhatId), and you still can’t use EnhancedLetterheads if you’re using EmailTemplate from community. Otherwise you should be good.


great to hear – thanks Jack


Hello Alex,

thanks a lot for your hard work, I am looking for that kind of solution for a long time. Unfortunately the link for the updated version (1.1 unmanaged) is not working. I only see “v0.1 Beta” in the version details and the testing flow is not opening at all (loading loop, so I can’t open it) after package installation.

Can you provide a new link to the actual update?

Thanks a lot!


Hey Alex,

thanks a lot, it works like a charm now.
Do you think its somehow possible to get user input for the default template to work? I imagine a similar functionality like using a template in the activity timline were the user can alter the email template (except letterhead).
Unfortunately flow input variables for rich text fields in aura components are not supported as far as I know. You have any other ideas?


Hi, thanks a lot for your hard work . I am just having issues with a null pointer exception if I dont include an attachment and no email is being sent when attachments are included, no error but no email sent

Johann moulin

Hello Alex, thank you for this code. I have the same issue. I don’t think I have hit the limit and email are enabled in my org. Last message is a success but no email is sent. If I disable the attachment, it works fine. I use a collection of attachment (no need for cdl because my object uses attachments). Thank for your help

Johann moulin

Alex, I have tried with the conversion of cdl and it works fine. So when I create a collection of attachments, it doesn’t send the email, when I create a collection of cdl and I pass them through the convert action, it works fine. Hope it helps


Sorry Alex, been on holiday, I am using a sandbox


Sorry for late response been on holiday, I now have an “Attempt to de-reference a null object error” not using attachments this time.


Well, I have solved this issue. When you get the attachment in your flow, you have to request all the fields (Id, Name, Contentype and Body). Once you have requested all these fields, it works fine.


Hi Alex,
thank you for this development, is there any chance when send the email , save it under the activity history ?


thanks Alex, i am aware of this option, but can your component work as the standard quick action of send email? i mean when you send an email to a non contact or lead, an activity history of the email recorded under the record and also the html body not broken (if you use tasks the html body will appear with the tags)

Eden Shochat

Alex, thank you so much. It’s insane this is not built into Salesforce. Quick question: I see the “Save Activity” option saves a “Closed” (vs. “Completed”) Task. Is that by design? It would seem a Closed task stays open as far as Salesforce is concerned?


I had this experience as well. The Out-of-the-box Task Status Value is “Completed” and is set to ‘Closed = True’. However, this component creates and sets the Task Status value to “Closed”. As a workaround I created a Task Status Picklist Value of “Closed” and set the “Closed” checkbox to checked (true). Then I deactivated the value so my users couldn’t select it. Now the task created by the SentHTMLEmail component will be in the activity timeline as a closed task rather than open. Adjust any Activity reports that may be based on your status values. Ideally, an Admin would… Read more »

Derek Hawley

I really appreciate all the work you do with Flows and the time you dedicate. This website has been a huge asset for me. I wanted to ask if there is a way for this to work with an email relay? When using the simple email action, emails are sent from my email relay. When sending emails using SendHTMLEmail Action they are sent via the Salesforce domain.

Thanks for the help.

Tamar Erlich

Hi Alex, can this functionality be extended to use an email field or variable to specify the sender email (e.g. I want the email to come from the contact owner’s manager or the SE on the contact’s account team)
Thank you for all the amazing work you do for the Flowhana

Gidi Abramovich

Alex Hi,
Your Email solution is great!!!
We are finally able to receive rich text emails without HTML tags 🙂
Is it possible to add multiple recipients’ emails with comma-separated?

It will be great if we could define a Public Group as a recipient, so all of its Group Members will receive the email.

Thanks a lot for the hard work you are doing!



Toggle signature on / off doesnt seem to do anything. Current user’s salesforce signature gets added into the email no matter what. Can we fix this 🙂


Thanks I toggled it on and then set to false 🙂


Hi Alex,

Merge field option is just for contact lead and users in classic and lightning templates both. Is this correct ? will not work for any other objects.

Also I installed the package in sandbox but send html email action does not appear.


Thanks Alec for your quick response.

Josh Dayment

Is the inline image still a bug I have tried copy and pasting as well as using the image button via the text template editor but images are still coming through broken in the email.


Yes, support for images is not yet implemented there.

Eli Pogorelov

HI, I installed the package, but receiving an error when entering the Send HTML email Test flow : Failng descriptor {markup://builder_platform_interactions:canvas}


Hi, could anyone explain how to install this package? I’m quite new to this field

Megan Moody

I just installed and tested 1.31. The email sends great, however, it’s not adding a copy of the actual email to the case feed. Is there a way to do this? I am pretty sure a previous version of this did this. I tried setting saveAsActivity to TRUE, but that just logs that an email was sent and doesn’t display the actual email sent. I am trying to send via a template.

Megan Moody

I also tried sending via an HTML body from the action itself (vs. a template) and that didn’t save the actual email to the feed either.

Megan Moody

What I ended up doing was adding the following to the code below setting of the subject:

// Log the email to the feed of the record

Because of the business requirements, I needed to log the actual email sent to the user. The above did that. Thank you!

[…] a Flow that uses the Send Rich Email action. Use the “Autolaunched” Flow Type. Configure the flow with input variables to capture […]

Wendy Tanner

Is there an option to review the email before sending it? This looks like a solution, but the team wants to choose the template then review before sending.


I tested this on Sandbox and it works well but when I tried in prod it only works if its triggered by users or PB but not with scheduled flow. :'(

Josh Dayment

I have a flow where I do something similar where I store the email body in a variable and display that variable on a screen using display text. I also have another version where we actually store the email in a custom object (very specific use case) then I use the recorddetail component to actually update the email body.


This is a huge Help!!

Is there a way to send HyperLink to a record in a text Template resource? I haven’t found a way to send a link to a record that is nice and tidy… I was only able to send a full https://…./{!CaseID} as link.
It could be beautiful if I could be able to send only the Case number as the link to the record.
Someone has tried that and figured it out?


Has someone found a way to send HyperLink to a record in a text Template resource?

Josh Dayment

I use the hyperlink functionality right in the text template and use a separate variable that is unique to each record I store a url on {!Get_Attendee_Record.Annotated_Post_Event_Survey_URL__c} in another use case I type out the url and if I need to pass the record id I use a variable there as well i.e.{!recordId}/view


Hi Josh, Thank you for your answer.
I currently use the second option – display the url but I would like to only expose a short text as the link to the record. Would you be able to post all the formule with the hyperlink that you use – I couldn’t quite figure it out from your comment.

I will much appreciate this 🙂

Thank you.


Josh Dayment

shoot me an email to and I will send you a few screenshots

Kou Xiong

Is there a reason why the ConverAttachment action is not included in the 1.31 version?

Jack D. Pond

Using the SendHTMLEmail, you can send emails in a selected language using the localized version of and email template. I’ve forked a project for our own use but If there’s interest, I’d be glad to contribute the work.

For details, see


Bill Fox

We do not use CRM and have built a platform on We do not have Accounts, Contacts or Leads. Will this work for custom objects?

Alex Edelstein

You’ll need a flow action that extracts email addresses from your custom objects And turns them into a collection of strings that this action can except as input.That’s easy to do with Invocable Actions and Apex

Peter J. Rozek

We are attempting to use this with a Visualforce template. The process starts at Process Builder on a Opportunity. Opportunity details are merged into the template. Is there a way to tell the visualforce template the ID of the opportunity to use in it’s merge fields?

Peter J. Rozek

We’re feeding value in, but we’re getting this error, despite having set the value to Global Constant.False

errors (SendEmail failed. First exception on row 0; first error: INVALID_SAVE_AS_ACTIVITY_FLAG, saveAsActivity must be false when sending mail to users.: [saveAsActivity, true])
isSuccess (false)

Peter J. Rozek

It doesn’t want to pick up the “Associated RecordId(WhatId/recordId for template and activity)” It send the emails, but they are blank. I have a value (an Opportunity ID) in this field, but it won’t merge anything from that record, nor from the contact. Just a bank page.


Has there been any change to the support of including images in the email body?

Pedro Carmo

Hey Alex, I’ve managed to get the action working fine, except for 2 minor hiccups: 1. When trying to use the SendTOthisStringCollectionOfEmailAddresses – I’mflow trying to push a longtext field (where I’m already capturing a list of email addresses separated by comma:,,etc…) into that option, but it doesnt allow me to choose any fields on the Record (Single) Variables – it only presents options for lookup fields of the record, not any other field type… 2. I’ve configured the PB/Flow combo in a way that I trigger the flow action in 2 or more (child) Cases simultaneously, via a… Read more »

Pedro Carmo

Thanks Alex.

When trying to install v 1.32 I got an error related to bad test classes in my sandbox. I’m gonna try it all out in a fresh dev org and will keep you posted of the results!


Pedro Carmo

Hi again Alex,

I just noticed that the link you provided to the 1.32 package is actually saying its the 0.1 version…


Hi Alex,

I’m also sporadically getting the error message “The number of results does not match the number of interviews that were executed in a single bulk execution request.”. I only get it when the the flow is triggered in quick succession but even then it doesn’t occur every time. When I debug with the same record it runs without issue. I’ve upgraded to version 1.32 but am still getting it. Is there anything else I should be looking at to prevent this from occurring?

Thank you.

Alex Edelstein

I suggest you post on that error to the trailblazer community ( There’s a lot of expertise on bulkification and multiple triggers held by Process Builder users.

[…] input parameters requires strings in one of two forms. Send Rich Email, for example, can take a list of string email addresses but can’t (currently) take a […]

[…] Check it out […]

Peter J. Rozek

Hi Alex,

I had replied to my own post from Feb 6th with some additional information; not sure if you saw it. Any thoughts about the error and how to identify the correct record to feed the email template?

Many Thanks,


Peter J. Rozek

I upgraded to 1.32 and I can get emails to send, I’m not getting any merging. I’m passing: 1. An Opportunity ID to Associated RecordId(WhatId/recordId for template and activity), 2. A User ID to Template Target Record Id 3. A Classic Email Template ID to templateID Some of the commentary on this site, and the Youtube video, suggest that #2 is what’s used in the merge. But I think what you’re saying on the 1.32 page is that #1 is also contributing to the merge. Which one is the source record that the email template should be merging into the… Read more »

Jack Pond

Hey Peter, I haven’t had time to replicate this but there are a couple of things you may want to look at. If you are getting the send, obviously 2 isn’t the problem. So let’s look at 1 and 3 in probability order. 3) A Classic Email Template ID to templateID. I did the contribution because I could, under no circumstances get relatedTo to work with the classic templates. Either HTML or VisualForce bodies. After looking at everything online, the solution was to add additional fields to the target record and use the {{{recipient. . .}}}. I haven’t gone back… Read more »

[…] This is extended functionality of Send Rich Email. […]

Ryan Schierholz

Thank you for your work on this, Alex. I am a user of Jeremiah’s ‘Legacy’ version, so when I saw someone had built on that, I was excited to check it out. However, I am shocked that I cannot find the ability to link the email sent (Save As Activity) to the contact(s) receiving it. In Jeremiah’s version, there is a Target Object Id which allows me to save to the activity log for that Contact. Did I overlook something (I’ve looked many times) or did that get removed from your adaptation?

Jack Pond

Ryan, I just ran a test and it was successful. There are 3 parameters you should consider
saveAsActivity = true
Associated RecordId(WhatId/recordId for template and activity) = the record on which the activity will be posted
Template Target Record Id = the record to which the email will be sent.

Note: In classical templates to determine which merges/activities,
Recipient == Target Record Id
relatedTo=WhatId/recordId (this is where the activity will be posted, not on the Target RecordId)

Alex Edelstein

Jack, this is a great example of where the functionality is powerful but the documentation needs to surface it more. let’s add a specific section to the main documentation here at called something like “Linking the Email To a Record (Logging Sends)” that makes this easier to find

Jack Pond

Agreed – and I’m going to try and look at it in a more holistic view 1) The functionality is very complex and not well documented anywhere – even within the SF Documentation of the Messaging class. I got very confused between TargetObjectId and WhatId, and the only way I figured it out was trial and error 2) This is a class area for CPE, but even then, it needs to be rethought re: complexity and presentation in a more logical delineation. 3) Is there someone on the team that can help here? I always sucked at clear, concise documentation… Read more »

Alex Edelstein

If you want to write a first draft, I’ll do an edit pass on it. Just write it out as if you were trying to explain it, and add images where convenient.

Ryan Schierholz

Thanks. FYI, when I try to ‘like’ a comment here, i’m presented a login screen. I use Google (which worked on the original comment), but then it loops me back to trying to login with WordPress. Never works to ‘like’ as logged in with Google.

Nino Y.

What is the expected input for the email collection fields? It keeps saying “invalid input” for whatever I try.

Jack D. Pond

Nino, They expect a collection of objects. If you are invoking through Apex, it would be a list of objects for example.
List<Contact> thisParam = new List<Contact>{ new Contact(), new Contact() }
If you are invoking through a Flow, it would be a collection variable. Example when you create the New Resource:
Resource Type == Variable
API Name == [Your API Name]
Data Type == Record
Select checkbox Allow Multiple Values (Collection)
Object = Contact


Hi Jack, I’m trying to use the Flow. Would they have to be a Contact object? could I do an area of string?

Nino Y.

I am trying to use the Flow. Would the variable have to be a contact? could it be just an array of strings?

Ryan Schierholz

Hey guys, I am doing another testing of this. (Thanks for the feedback on the settings the other day.) This time, I am trying to pass in an Email Template ID, so when it’s updated in the future, I don’t have to re-publish a flow. The email goes to a User an dis associated with a custom object Closing. I have linked the Closing__c object on the Email Template in the Related Entity Type field. I have set the Associated Record Id / WhatId to the recordId of the Closing__c object for the flow, and the Template Target Record Id… Read more »

Jack Pond

Ryan, sorry for the delayed response. I get this message when I am trying to use Enhanced Letterhead with community initiated flows. SF has confirmed there are issues in this framework. If there are other fields/issues, I can add this to the same support request which is currently with the SF Development Team. The latest I heard was as follows: I would say that at this point, the issue has been narrowed down to the Guest User access logic, which has been under a lot of adjustments recently. A logged-in user on a Community would likely be able to… Read more »


Thanks for the reply, Jack. So, this is NOT community/guest access and I did NOT specify any letterhead on the template; therefore, it seems that would not be applicable to me … ?

Jack Pond

I should have said that better – the entire EmailTemplate environment is under review because of the issue about REQUIRED_FIELD_MISSING – which varies between different Objects, Standard and Custom. The best advice I can give you is set up a log and determine WHICH field is not being viewed – it will probably come down to either a sharing problem or you are using a standard object that may somehow be restricted for the license type of the user context you are in when executing the flow.


Ryan, did you ever figure this out? I’m running into the same issue

Ryan Schierholz

I have not had more time to spend on it.

Jack Pond

Ryan, were you able to determine WHICH field is the REQUIRED_FIELD_MISSING?

Clay Davis

So far, this is working as intended EXCEPT for attachments. I am using the newest version and passing a collection variable of ContentDocumentLinks into the action as shown. The Email sends, but there are no files attached. I have verified that the collection variable contains at least one ContentDocumentLink Id. Any guidance?

Alex Edelstein

Hmm. I just tried it out and verified that it works on my org. Double check the new content at . However it sounds like you’re doing the right thing. Upgrade to version 1.32 if you’re not already on it. I think someone broke attachments a ways back and then it was fixed. Make sure the file you’re testing with is innocuous (small, simple).

Clay Davis

Alex, thanks for the reply. I figured it out. I hadn’t included the ContentDocumentId in the sobject variable feeding the collection. Once I corrected that, everything worked as intended.

John Seale

Hey – this is a perfect plugin, but I’m having a funny issue – when I build the flow, it works just great in my testing. But as soon as I turn it into an autolaunched flow, when the time comes around I get the error “Error element Send_The_Email (FlowActionCall). Profile does not have access to sendhtmlemail” This is probably less an issue with your code and more an issue with my implementation, but what am I missing? Why does it work when I run it manually from the Flow Builder, and not when Salesforce tries to auto-launch it at… Read more »

Jack Pond

Hey John, I will be the first to admit that I’m NOT a skilled administrator, but given your problem, it sounds like your User Profile may have Enabled Class Access to sendHTMLEmail, but whatever user context the midnight autolaunching is launching in does not. You can check with Setup–>Apex Classes–>SendHTMLEmail–>Security or make sure you installed for all users.
Add Profile to Access

John Seale

Sadly, I just checked that and it is enabled for all profiles….

Alex Edelstein

Check out the Considerations at . It looks like there might not be a way to mix invocable actions and scheduled Flows right now, if you’ve enabled the CRUC for Apex Security, because we don’t have a way to enable the Automated Process User to have access to specific Apex classes. I’m looking into how this will be addressed.

John Seale

Sad! I’ve just deactivated “Require User Access to Apex Classes Invoked by Flow”. I’ll let it go overnight and we’ll see it if fails or succeeds overnight. There’s 349 days until this update is automatically activated, so at least we can push that long! Maybe Salesforce will provide a workaround in the meantime, or they’ll build HTML email into flows themselves.

John Seale

I’ve been fiddling with this, and it’s still giving me fits. After deactivating the critical update, the whole process became invisible. No more error, but no email either. Now scheduled autolaunched flows aren’t sending any emails at all. I even tried creating a dummy flow to be autolaunched at a specific time, and literally all it does it start, create a silly record (so I can tell it did actually run), and send an email using both the built-in SF sendemail action and your sendhtmlemail action. The flow runs, creates the silly record, and then that’s it. Silent failure. Any… Read more »

Roland P.

Hi – this has been great to integrate so far. I am building a flow to forward lead information to our sales partners via Email. My flow takes the recordID (goes into Template Target Record Id) from the lead it has been started from. Then it takes the current user and finds a classic email template by UserID. All works well except the message gets sent out to the Lead Email address. I have nothing in Send HTML Email that would trigger such a behaviour. What am I missing here? I only want the message to go out to the… Read more »

Jack Pond

Template Target Record Id[templateTargetObjectId] == Recipient and Associated RecordId(WhatId/recordId for template and activity)[recordId] ==


I have “Template Target Record Id” == {!recordId} == Lead
Associated RecordId is not included. Does this need to be set? The flow runs as expected except it sends a copy to the lead address even though it is not mentioned in flow variables or anything alike. It behaves just as if I would have drawn up the email template in the regular email function on leads.

Jack Pond

see above. you need to assign both Recipient Id and Lead Id to their respective params


Is there any way to get an installable package that excludes the TestFlow? There’s a step in the TestFlow that Gets Contacts. Trying to install this package fails because we have an encrypted field tied to Contacts. We do not have a use case to email Contacts, so this should not be a road block.
“Flow filters can’t reference encrypted fields” is the error that displays.

Jack Pond

@thompsst, Currently in alpha development is a new version that does not automatically create the Contacts for tests and a version that does not have tests included at all. If you’d like to try them out and give some feedback whether this helps you, I’d appreciate it.

1.33 Unmanaged sendHTMLEmail (with Flow Examples/Tests) – Added documentation, validations, examples)
1.33 Unmanaged sendHTMLEmail(No Tests) – No Flow tests or examples (Added documentation, validations)

Draft DocumentationDraft Documentation for 1.33

Stéphane Houle

I am on 1.3 (keep getting error messages when I try to upgrade to 1.32). Whenever I try to send an email with an attachment (using Content Document Link), my flow debug screen gets stuck infinitely on the screen before the email gets sent. The flow works fine without attachments.

Any idea?

Jack Pond

Stéphane, what type of related object are you using when specifying recordId?

Stéphane Houle

CPQ Quotes (SBQQ__Quote__c_).

Stéphane Houle

I’m trying to get Quote PDFs on the Primary Quote of my Opportunity (which is my starting record).

Jack Pond

So your Template Target Record Id(templateTargetObjectId) is Opportunity and your Related Record Id (recordId) is SBQQ__Quote__c?

Stéphane Houle

I don’t use any of those parameters, I’m using a text template that’s in the flow itself since I’m passing information from my flow screen and multiple related objects.

Just realized there was also a video, so I’ll watch it and hopefully I’m just missing some easy stuff somewhere :).

Jack Pond

Look especially at: Template Target Record Id(templateTargetObjectId) is set to Opportunity Id and your Related Record Id (recordId) is set to the SBQQ__Quote__c Id


Hi there, I’ve received the following error message while trying to install the latest version (1.32): Your request to install package “SendHTMLEmail ver 0.1” was unsuccessful. None of the data or setup information in your organization was affected. If your install continues to fail, contact Salesforce CRM Support through your normal channels and provide the following information. Organization: xxx User: xxx Package: SendHTMLEmail (04tB0000000Awk2) Problem: 1. Apex compile failure Apex class Test_ApplicationDetailsLightningCtrl: line 59, column 69: Method does not exist or incorrect signature: void getAllOpportunityFiles() from the type ApplicationDetailsLightningController 2. Apex compile failure Apex class Test_ApplicationDetailsLightningCtrl: line 75, column… Read more »

Jack D. Pond

Florian, There is a beta version awaiting pull – if you’d like to be a pilot tester, give one of these a try (They both should not encounter the issue):
1.33 Unmanaged sendHTMLEmail (with Flow Examples/Tests) – Added documentation, validations, examples)
1.33 Unmanaged sendHTMLEmail(No Tests) – No Flow tests or examples (Added documentation, validations)


Hey Jack, thanks for your quick reply! I receive the same errors while trying to install one of the option you’ve mentioned. But thats fine for me as 1.31 seems to work for me at the moment. However I’ll attache the error message: Package: sendHTMLEmail(No Tests) (04t3h0000019dUk) 1. Apex compile failure Apex class Test_ApplicationDetailsLightningCtrl: line 59, column 69: Method does not exist or incorrect signature: void getAllOpportunityFiles() from the type ApplicationDetailsLightningController 2. Apex compile failure Apex class Test_ApplicationDetailsLightningCtrl: line 75, column 17: Variable does not exist: documentSelection 3. Apex compile failure Apex class Test_ApplicationDetailsLightningCtrl: line 79, column 62: Method does… Read more »

Jack Pond

Florian, Let’s try and contact directly, then post what we found here instead of cluttering this thread – you can find my information on github,

[…] Send Rich Email (Send HTML Email Action) Ver 1.33 has been released. It is a minor bug fix and document update release including: […]

Chris H

When sending a templated email, and enabling saveAsActivity, a completed task is created against the Related Record ID. Question is… may I set the task’s fields? Currently, the task is created against the RelatedRocordID with the following fields/values: Sent Email: “null”, Subject: “Send Email: null”, Name: “”.

I would like to capture the template name and perhaps capture some additional values.

Thank you.

Jack Pond

Hey Chris, I was able to replicate this. Could you submit as an issue and I’ll look into it.

Chris H

Done. Issue #316 has been created. Thanks for the hard work on this solution Jack and community! It is a great asset.

Jack Pond

Chris, I think I may have found the issue and will fix in the next release.

Interim workaround: Use Flow to create and specify Subject and specify it in Action Component parameters (same with other fields)



First of all, thanks a lot for this component Alex, really great!
I have an from my dev sandbox: In the received email, the FROM shows the email of the flow running user instead of the email that I manually set in replyEmailAddress. Is this a known issue or am I missing something? The value set in senderDisplayName works fine. Note: i run the flow logged in as a sales rep.
Cheers, Xavier

Marc-Adrien Paris

Got the same issue 🙁

Adan Levy

Hello, thank you for this very nice development! Just two questions:
1) is there any way to register the activity exclusively in the contact? I tried to put a contact ID in the whatid but it rejects it, so i have to choose another object to get the activity posted (in my case Recurring Donations object).
2) is there a possibility to create just the email activity record (grey one) and not the activity (task)?

Jack Pond

Adan, I’m going to open up an issue on this one, but I’d like to discuss a redesign with Alex etal.

Chris H

Hello again. This is a really slick solution. I am using it to send a classic template and am associating the send to both a contact and a case. I noticed that the activity on the contact record is associated to the HTML version of the email, but the activity on the case record is associated to a plain text version. Is there a way to associate the HTML version to both the contact and case? My implementation of the action includes: orgWiedEmailAddressId Related Record ID(whatId/recordId) = case id saveAsActivity: True Template Target Record ID: contact id templateID Is this… Read more »

Jack Pond I found the whole activity/history very confusing, and even conflicting in different implementations (Classic v LIghtning, Plaintext, HTML, and just the Email and messaging base classes and methods). The technical answer to your question is probably a result of, but taking a deeper look at the functionality I think you’re asking for.


Thank a lot for creating this functionality. I’m trying to use this instead of the SendEmail action on a daily schedulable Lightning Flow. I thought that if I have a Collection of emails set on the “SendTOthisStringCollectionOfEmailAddresses” parameter, then each of those recipients would get a separate email, but instead all those recipients are getting the same email message. What am I doing wrong?

Jack Pond

Ron, This is working as designed – it adds all addresses passed into the To, CC, BCC, . . . as received. If you would like to send individual emails, try using a loop – but remember you may start running up against limits.


Thanks for the response Jack. It’s a shame that I can’t use this for sending individual emails. I tried it with the loop and it works, but as you correctly pointed out, it hits the limits quite quickly.
“An Apex error occurred: System.LimitException: Too many Email Invocations: 11”
I’ll look for other solutions 🙁

Alex Edelstein

Are the email addresses coming from Contacts, Leads, or Users? If so, I think you can make this work as follows: When setting up the schedule, apply a condition that loads a list of Users, Contacts or Leads. The Scheduler will fire the flow one time for each record, and then email to it. If your email addresses don’t live in Contacts, Leads or Users, then the action doesn’t currently support this approach. However, it wouldn’t be hard to create a version of the action that took a dynamic SObject input along with a field name. Suppose you have a… Read more »


Thanks Alex. My flow is scheduled to run on Opportunities. On Opportunities I have a custom look up to Contacts to whom an email must be sent. The schedulable flow starts with “Get Records (Opportunities)” which are stored in a collection. This is followed by a loop on the collection to pull the email addresses of the Contacts via the lookup field. The Emails are stored in a Collection of text variables. At the end of the loop, I’ve added the SendHTMLEmail action to send the emails using the “SendTOthisStringCollectionOfEmailAddresses” parameter. I think you’re suggesting that I store the Contacts… Read more »

Alex Edelstein

Are you using the Choose Object batch definition UI that’s part of the Schedule Trigger? If you do your query for Opportunities there, the flow runs one time for each opportunity. If your flow then looks up the contact of its one opportunity, and


creating collections, you should be good. each instance of the flow will only be submitting a single contact to the Send Email action.


Hi Alex. I’m not sure I understand the meaning of “the Choose Object batch definition UI that’s part of the Schedule Trigger”. I think you mean using the “Start” element to set the schedule and define the set of records to run through the flow. When I do that, I get 2 types of errors – 1. For more than 10 records, I get the error “An Apex error occurred: System.LimitException: Too many Email Invocations: 11” 2. For less than 10 records, I get the error “The number of results does not match the number of interviews that were executed… Read more »

Jack Pond

Ron, @Alex. When I was redoing some major sections of sendHTMLEmail (1.33 and 1.33.1), it raised some serious questions about the efficacy of bulkification in the multi-send environment. This related to both the send message and the creation of activity records post-send. Ron, this isn’t going to help you in the short term, but I am going to go back and create a sophisticated test (in sendHTMLEmailTest) for bulkification which will probably better clarify both how the current action works and perhaps a better approach in the future. It is part of (sendHTMLEmail – Activity History Redesign?) 1.33.1 (I’m… Read more »


Thanks Jack.
If only there was a way to break up the schedulable flow trigger to operate in batches of 10 or less records in the way that we can for Data Loader.
I might have to bite the bullet and go back to using an Email Alert or the native Send Email action.

Jack Pond

Ron, can we switch this conversation to This is going to require some interaction that could clutter this page. I’ll be watching for your post there.


Quick update Alex – I changed my flow to run on a Collection of Contact records, but that didn’t work. It still concatenates all the emails into the To field and sends the same email out to all recipients instead of one per recipient.
I read your earlier comment again and understand that you’re suggesting to run the flow on Contacts, Leads or Users if possible. Don’t think it would be possible with my business requirements.

[…] Updated Documentation with new example flow information […]

Mike Glantzberg

I can’t seem to get this to fire on a scheduled job. It runs when I hit run and gives me the exact response I’m expecting but for some reason it doesn’t seem to want to run when I schedule it. I ran into a similar issue with plain text, The workaround for this was to set the Sender Type as the DefaultWorkflowUser. Is there a place to put this? I would much rather use the opportunity Owner Name and email address instead. Thanks for your help on this. Really love how Flow is shaping up.

Nicholas Hodge

Hey all! I love this so far, but I’m having a couple of issues (I’m guessing I’ve done something wrong).
1. Everything works in my flow in Debug (I’m passing in a template ID) – but the email is always blank
2. The activity record is created on the Contact correctly, but it’s not tracking history (open/unopened/etc…)

Any thoughts offhand what i’m doing wrong? Anything else I can post/show for insight?

Jack Pond

Nicholas, did you run the new (1.33.2) and use example 4? Run example 5 first (that will create templates for you), then use one of those template IDs for Example 4. Check back here if having the same problem.

Jack Pond

Forgot to tell you, you will have to create a valid Account and Valid Contact to run Example 5

Nicholas Hodge

Ran example 5 – no templates were created (or if they were, I cannot find them)

Nicholas Hodge

Found the email template via workbench – but there doesn’t seem to be a way to edit it… plus, does this mean I can’t use any of my pre-existing templates with this APEX/flow process?

Jack Pond

Sorry for the delay inf feedback Nicholas. I can’t say for certain, but it sounds like you have a protection/sharing issue with your templates. A couple things to check is to make sure the Apex Class is enabled for all users you wish to use it (profile or permissions), and then open the templates wide. I was never able to get Classic templates with related records working, but that was just with merge fields. Tell me if you’re still having issues.

Dave Ries

This Action could save me a lot of work! Thanks! Just 1 small issue I found. The Test Class will fail if an org has too many OrgWideEmailAddresses. I added a “LIMIT 2” to the SOQL on line 478 of the Test Class, and it resolved the issue. Without adding the limit, I was getting the following error: “System.LimitException: Too many Email Invocations: 11”.

Jack Pond

Dave, I will add this to the next release. THANKS!!!

Ryan Schierholz

Again, thanks for this tool, it’s been quite helpful when it works. A little frustrating when it doesn’t, though 🙂 I have a process builder process with Scheduled Actions. When certain timing criteria are met, the PB triggers a Flow with certain variables. The Flow runs and sends emails based on the variables input. 95% of the time it works, but some mornings I have FlowApplication error emails in my inbox with the error “Error Occurred: The number of results does not match the number of interviews that were executed in a single bulk execution request.” I looked at the… Read more »

Alex Edelstein

Could you try doing it with the Scheduled Flows capability instead of Process Builder? There might be something about keeping it within Flow that would help here.

Also you might want to ‘forward’ launch it using this:

Ryan Schierholz

Isn’t the Schedule jobs flow capability based on set dates/times? our scheduled actions are relative to dates added in the record, i.e. 62 hours before Inspection_Deadline__c

Jack Pond

Ryan, this may have absolutely nothing to do with your problem, but in 1.33.1, there are two types of errors that can be returned, the parameter validation checks and the actual attempted send status. If you have one or more parameter validation checks fail for one or more of the requests and one or more actual send attempts, the count in the return collection may not equal the count in the requests collection. This has been fixed in 1.33.2, but not released yet.

Jack Pond

Ryan, I have been re-doing bulkification but not yet ready to make a release(1.33.2). The bulkification has been pretty much re-written and should work now, but the rest has not been completed. You can get a copy of the development versions here:, but caveat emptor, the parameters have not been documented. Also beware that you might be experiencing a limits issue – in which case this will do nothing for you.

Just copy the SendHTMLEmail.cls and SendHTMLEmailTest.cls into your classes

For more details on what might be happening, check

[…] Answer from Sam Reynard, @samreynard, Automation: We plan to start improving the email functionality in flow soon! Top of mind is allowing you to send rich-text emails from Flow, but support for Classic and Lightning templates is also on the roadmap. In the meantime, we do have a community-maintained action that delivers this same functionality. On , check out the “Send Rich Email” action. […]