
Use process build, flow or apex to send an email
See the sent email in the activity feed

We strongly recommend using Flows to send emails – they are better than process builders and easier to debug.
#1 Install
- Upvote the idea for Salesforce to make this standard.
- Install the package – this only works on Enterprise edition and up as it requires apex code. Or view in GitHub.
- Open a flow
- On the actions select the “Apex Class” option
#2 Select the recipients
- Related To ID – the ID of the record you want to relate this to (eg. account or opportunity). Not a contact, lead or user
- Contact/Lead ID – Required if you use an email template
- ‘To – To Addresses’– enter a comma-separated list of email address. Eg. [email protected], [email protected]
- ‘To – bcc Email Addresses’– comma-separated list of email addresses to go into the BCC field
- ‘To – cc Email Addresses’ – comma-separated list of email addresses to go into the CC field
- ‘TreatTargetObjectAsRecipient’ – true or false – if false it won’t send the email to the contact or lead
- If no value (eg. null) it will default to true if there a contact/lead id provided and it has a valid email address
#3 Enter the email content
- ‘Body – Template Id’ – the id of the email template. eg. 00X600000012maf
- Or instead, use ‘Body – Template Unique Name’ with the unique name (API name) of the email template. eg. “Email_template_name”
Or write your own content. You cannot use custom content with an email template due to a limitation in Salesforce Apex:
- Subject – specify the subject
- ‘Body – Plain Text ‘ – enter a plain text body
- ‘Body – Html’ – or an HTML body
- ‘Body – Use Signature’ – include the user’s standard signature
#4 Attachments
- ‘Attachment – ContentDocument – Comma Separated Ids’ — This is the ContentDocumentId of the document you want to attach. It will take the latest ContentVerion.
- ‘Attachment – ContentVersion – Comma Seperated Ids’ to specify a specific ContentVersionId
- ‘Attachment – Comma Separated Ids’ – List of Attachment Ids
- For example, 0690o12312321GKOT, 06934234234TGH
#5 Optional Extras
- ‘From – Org Wide Email Address’ – Specify a specific from address. This must be an org wide email address.
- ‘Setting – Save As Activity’ – You decide if you want to log the email as an activity or not. Defaults to True
- ‘Setting – Apex Error Email’ – Send an email to the specified address containing all errors
- ‘Setting – email Opt Out Policy’- this helps define what you do if a user has opted out of receiving email
- ‘Case Id’ – when provided, Implements the case threading functionality (not this only applies the logic to the outbound email, you will still need to add your inbound handler)
Limitations
- You cannot use Email Templates without a Lead or Contact Id. This is a limitation of Salesforce Apex code. One workaround is to create a dummy contact. We know this is not ideal
- Apex email sends have a limit of 5000 per day across your org. Note that all recipients in the to, cc and bcc fields count against this limit An example being an email with 2 addresses in the “to” field and 1 address in the “cc” field would count as 3 calls against the limit.