# FLOW_SendEmail

**Class** · Group: `Email`

Learn it: [Utilities guide](/utilities-guide)

<div class="apex-member apex-class">

```apex
global inherited sharing class FLOW_SendEmail
```

Provides an invocable entry point for sending emails via Salesforce Flow with advanced capabilities. Supports: Hybrid execution (Direct Apex or delegating to a secondary Flow). Custom Merge Fields (replacing [placeholder] text). Conditional Activity Logging (using standard TargetObjectId or the Workflow Engine).

**Example**

```apex
FLOW_SendEmail.DTO_Request request = new FLOW_SendEmail.DTO_Request();
request.toAddress = 'customer@example.com';
request.templateUniqueName = 'Customer_Welcome_Email';
request.orgWideEmailAddress = 'noreply@company.com';
request.whatId = opportunityId;
request.saveAsActivity = true;
List<FLOW_SendEmail.DTO_Response> responses = FLOW_SendEmail.sendEmail(new List<FLOW_SendEmail.DTO_Request> {request});
```

</div>

---

## Methods

| Method | Description |
|--------|-------------|
| global static [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm)<[FLOW_SendEmail.DTO_Response](/reference/apex/flow-sendemail-dto-response)> [sendEmail](#sendemail)([List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm)<[FLOW_SendEmail.DTO_Request](/reference/apex/flow-sendemail-dto-request)> dtoEmails) | Invocable method to process email requests. |

### sendEmail

<div class="apex-member">

```apex
@InvocableMethod(category='Email' description='Sends an email using a template by delegating to an internal Flow. Optionally logs an activity, using either standard email limits or the Workflow Engine.' label='Send Email (Flow-Delegated) and Log Activity') global static List<FLOW_SendEmail.DTO_Response> sendEmail(List<FLOW_SendEmail.DTO_Request> dtoEmails)
```

Invocable method to process email requests.

**Parameters**

| Parameter | Type | Description |
|-----------|------|-------------|
| `dtoEmails` | [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm) | A list of DTO_Request objects configured in the Flow. |

**Returns** [FLOW_SendEmail.DTO_Response](/reference/apex/flow-sendemail-dto-response) — A list of `DTO_Response` objects indicating success or failure for each request.

**Example**

```apex
FLOW_SendEmail.DTO_Request emailRequest = new FLOW_SendEmail.DTO_Request();
emailRequest.toAddress = 'customer@example.com';
emailRequest.templateUniqueName = 'Customer_Welcome_Email';
emailRequest.orgWideEmailAddress = 'noreply@company.com';
emailRequest.whatId = opportunityId;
emailRequest.saveAsActivity = true;
List<FLOW_SendEmail.DTO_Response> responses = FLOW_SendEmail.sendEmail(new List<FLOW_SendEmail.DTO_Request>{emailRequest});
if(responses[0].success)
{
	LOG_Builder.build().info('Email sent successfully').emitAt('MyFlow.sendEmail');
}
```

</div>

## Inner Classes

| Class | Description |
|-------|-------------|
| [DTO_Request](/reference/apex/flow-sendemail-dto-request) | Data Transfer Object (DTO) representing the input parameters for a single email request. |
| [DTO_Response](/reference/apex/flow-sendemail-dto-response) | Data Transfer Object (DTO) representing the outcome of an email request. |

---
