> For the complete documentation index, see [llms.txt](https://docs.digibee.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digibee.com/documentation/connectors-and-triggers/connectors/web-protocols/email-v2.md).

# Email V2

The **Email V2** connector enables you to send simple emails in HTML format, with or without attachments.

## **Parameters**

Configure the connector using the parameters below. Fields that support [Double Braces expressions](/documentation/connectors-and-triggers/double-braces/overview.md) are marked in the **Supports DB** column.

{% tabs %}
{% tab title="General" %}

<table><thead><tr><th width="112">Parameter</th><th width="231">Description</th><th width="83">Data type</th><th width="81">Supports DB</th><th width="100">Default value</th><th width="128">Visible when</th></tr></thead><tbody><tr><td><strong>Alias</strong></td><td>Name (alias) for this connector’s output, allowing you to reference it later in the flow using <a href="/pages/cijmbAfZNYu7oJBb7Kd7#referencing-previous-steps-using-previous-steps-access">Double Braces expressions</a>.</td><td>String</td><td>✅</td><td><code>email-v2-1</code></td><td>—</td></tr><tr><td><strong>Account Type</strong></td><td>Type of account used for authentication. Supported: <strong>Azure Key</strong> and <strong>Basic</strong>.</td><td>String</td><td>❌</td><td><code>Basic</code></td><td>—</td></tr><tr><td><strong>Use Dynamic Account</strong></td><td>If enabled, the connector uses the account dynamically via the <a href="/pages/0kxlZ011XP4A2T43v9kh"><strong>Store Account</strong></a> connector; otherwise, it uses the account statically as configured in <a href="/spaces/jvO5S91EQURCEhbZOuuZ/pages/fS1QLzAg8rGSSJFwtrvy"><strong>Accounts</strong></a> on the Platform.</td><td>Boolean</td><td>❌</td><td><code>false</code></td><td>—</td></tr><tr><td><strong>Scoped</strong></td><td>If enabled, isolates the stored account from other sub-processes. Not supported for accounts used in headers or body. To learn more, read the <a href="/spaces/jvO5S91EQURCEhbZOuuZ/pages/cbkYqH3fxzeL7zOKNawz">Dynamic Accounts documentation</a>.</td><td>Boolean</td><td>❌</td><td><code>false</code></td><td><strong>Use Dynamic Account</strong> is enabled</td></tr><tr><td><strong>Account Name</strong></td><td>Name of the account defined in the <a href="/pages/0kxlZ011XP4A2T43v9kh"><strong>Store Account</strong></a> connector.</td><td>String</td><td>✅</td><td>N/A</td><td><strong>Use Dynamic Account</strong> is enabled</td></tr><tr><td><strong>Account</strong></td><td>Account used to authenticate with the email server. Required if the service requires authentication. Must be an <strong>Azure Key</strong> or <strong>Basic</strong> account type, configured in <a href="/spaces/jvO5S91EQURCEhbZOuuZ/pages/fS1QLzAg8rGSSJFwtrvy"><strong>Accounts</strong></a> on the Platform.</td><td>String</td><td>❌</td><td>N/A</td><td><strong>Use Dynamic Account</strong> is disabled</td></tr><tr><td><strong>SMTP Host</strong></td><td>SMTP server host. Example: <code>smtp.gmail.com</code></td><td>String</td><td>✅</td><td><code>smtp.gmail.com</code></td><td>—</td></tr><tr><td><strong>SMTP Port</strong></td><td>SMTP server port. Commonly 587, but may vary.</td><td>Integer</td><td>✅</td><td><code>587</code></td><td>—</td></tr><tr><td><strong>From</strong></td><td>Sender's email address.</td><td>String</td><td>✅</td><td>N/A</td><td>—</td></tr><tr><td><strong>To</strong></td><td>Recipient email address(es), separated by commas.</td><td>String</td><td>✅</td><td>N/A</td><td>—</td></tr><tr><td><strong>CC</strong></td><td>CC recipient(s), separated by commas.</td><td>String</td><td>✅</td><td>N/A</td><td>—</td></tr><tr><td><strong>BCC</strong></td><td>BCC recipient(s), separated by commas.</td><td>String</td><td>✅</td><td>N/A</td><td>—</td></tr><tr><td><strong>Subject</strong></td><td>Email subject line.</td><td>String</td><td>✅</td><td>N/A</td><td>—</td></tr><tr><td><strong>Charset</strong></td><td>Character set for the email body.</td><td>String</td><td></td><td><code>UTF-8</code></td><td>—</td></tr><tr><td><strong>Content</strong></td><td>Email body. Supports Freemarker templates for dynamic HTML.</td><td>String</td><td>✅</td><td>N/A</td><td>—</td></tr><tr><td><strong>Custom Attachments Specification</strong></td><td>Enables raw attachment input and hides the form-based attachment field.</td><td>Boolean</td><td>❌</td><td><code>false</code></td><td>—</td></tr><tr><td><strong>Attachments</strong></td><td>Email attachments. Specified via form or raw array.</td><td>Array of objects</td><td>❌</td><td>N/A</td><td><strong>Custom Attachments Specification</strong> is enabled</td></tr><tr><td><strong>Authenticated</strong></td><td>Enable if SMTP authentication is required.</td><td>Boolean</td><td>❌</td><td><code>true</code></td><td>—</td></tr><tr><td><strong>Is Over TLS</strong></td><td>Enable to send the message over TLS.</td><td>Boolean</td><td>❌</td><td><code>true</code></td><td>—</td></tr><tr><td><strong>Is Over SSL</strong></td><td>Enable to send the message over SSL.</td><td>Boolean</td><td>❌</td><td><code>false</code></td><td><strong>Is Over TLS</strong> is disabled</td></tr><tr><td><strong>Socket Port</strong></td><td>Required if SSL is enabled. Specifies the port used.</td><td>Integer</td><td>✅</td><td>N/A</td><td><strong>Is Over SSL</strong> is enabled</td></tr><tr><td><strong>Force TLSv1.2</strong></td><td>Forces TLS 1.2 for secure email server connections.</td><td>Boolean</td><td>❌</td><td><code>false</code></td><td>—</td></tr><tr><td><strong>Fail On Error</strong></td><td>If enabled, interrupts the pipeline execution when an error occurs. If disabled, execution continues, but the <code>"success"</code> property will be set to <code>false</code>.</td><td>Boolean</td><td>❌</td><td><code>fals</code></td><td>—</td></tr></tbody></table>

{% hint style="info" %}
To embed images in the email body, use the prefix `cid:` followed by the image name in the Attachments parameter. Example: `<img src="cid:image.png" />`
{% endhint %}
{% endtab %}

{% tab title="Documentation" %}

| Parameter         | Description                                                                             | Data type | Supports DB | Default value |
| ----------------- | --------------------------------------------------------------------------------------- | --------- | ----------- | ------------- |
| **Documentation** | Optional field to describe the connector configuration and any relevant business rules. | String    | ❌           | N/A           |
| {% endtab %}      |                                                                                         |           |             |               |
| {% endtabs %}     |                                                                                         |           |             |               |

## **Message Flow**

### **Input**

No specific input is required unless a Double Braces expression is used in any field.

### **Output**

The connector returns a JSON object like the one below:

```json
{
  "from": "a@a.com",
  "to": "a@a.com,a@a.com.br",
  "cc": "a@a.com,a@a.com.br",
  "bcc": "a@a.com,a@a.com.br",
  "subject": "Subject",
  "content": "<html>Test Email!</html>",
  "charset": "UTF-8",
  "success": true,
  "attachments": [
    {
      "type": "ATTACHMENT",
      "attachment": "attachment.extension"
    }
  ]
}
```

**Field explanations:**

* `from`: Sender email
* `to`: Recipients
* `cc`: CC recipients
* `bcc`: BCC recipients
* `subject`: Email subject
* `content`: Email body (truncated if over 256 characters)
* `charset`: Character encoding used
* `success`: Indicates if the message was sent successfully
* `attachments`: List of attachments

{% hint style="info" %}
Files are handled securely within a temporary directory exclusive to the pipeline.
{% endhint %}

Learn more about [Messages processing](/documentation/developer-guide/development-cycle/build-overview/pipelines/messages-processing.md) in the Digibee Integration Platform.

## **Email V2 in action**

### **Authentication**

**Email V2** supports the following authentication methods:

**Basic**

* Use a Basic account where the **username** is the sender’s email and the **password** is the corresponding email password.

**OAuth 2**

{% hint style="warning" %}
Currently supported only for Microsoft-based (Outlook) email accounts.
{% endhint %}

To configure:

* Set the **From** field with the sender's email address.
* Choose an **Azure Key** that contains the necessary credentials.

Internally, the connector uses `client-id`, `client-secret`, and `tenant-id` to generate a token, which is used along with the sender email to authenticate with the SMTP server.

### **Example: Email with attachments and inline image (RAW mode)**

**Configuration:**

* **SMTP Host**: smtp.gmail.com
* **SMTP Port**: 587
* **From**: <email@gmail.com> (the same email configured in the **Account** parameter)
* **To**: <some_other_email@gmail.com>, <second_email@gmail.com>
* **Subject**: Hello
* **Content**:

```html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>Demystifying Email Design</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<img src="cid:myImage.png" />
</body>
</html>
```

* **Authenticated**: true
* **Is Over TLS**: true
* **Attachment As Raw**: true
* **Attachments**:

```json
[
  { "type": "INLINE", "attachment": "myImage.png" },
  { "type": "ATTACHMENT", "attachment": "xpto.txt" }
]
```

**Output:**

```json
{
  "from": "email@gmail.com",
  "to": "some_other_email@gmail.com,second_email@gmail.com",
  "cc": "",
  "bcc": "",
  "subject": "Hello",
  "content": "<!DOCTYPE html PUBLIC ...TRUNCATED",
  "charset": "UTF-8",
  "success": true,
  "attachments": [
    { "type": "INLINE", "attachment": "myImage.png" },
    { "type": "ATTACHMENT", "attachment": "xpto.txt" }
  ]
}
```

### **Dynamic email example using Double Braces expressions**

You can use [**Double Braces expressions**](/documentation/connectors-and-triggers/double-braces/overview.md) to insert variables dynamically into your email configuration.

In the example below, we first configured the [**JSON Generator (Mock)**](/documentation/connectors-and-triggers/connectors/tools/json-generator.md) with the following data:

**JSON data:**

```json
{
  "sender": "digibee@gmail.com",
  "recipient": "digi@gmail.com",
  "recipient_cc": "digi1@gmail.com",
  "recipient_bcc": "digi2@gmail.com",
  "port": "587",
  "host": "smtp.gmail.com",
  "INVOICE": "98787979789",
  "DUE_DATE": "01/13/2023"
}
```

Next, we configured the **Email V2** connector using Double Braces expressions to reference these values:

* **SMTP Host:** `{{ message.host }}`
* **SMTP Port:** `{{ message.port }}`
* **From:** `{{ message.sender }}`
* **To:** `{{ message.recipient }}`
* **CC:** `{{ message.recipient_cc }}`
* **BCC:** `{{ message.recipient_bcc }}`
* **Subject:** `{{ CONCAT("Invoice ", FORMATDATE(NOW(), "timestamp", "MMMM yyyy", null, "UTC", "pt-BR", "GMT-3")) }}`
* **Charset**: `UTF-8: Eight-bit Unicode (or UCS) Transformation Format`
* **Content:**

```html
<!DOCTYPE html>
<html>
<head>
  </head>
<body>
 
Good afternoon, <br/>
Below is the invoice <a href='${INVOICE}'>(Click here)</a> referring to the monthly license fee for the platform – due for <b> ${DUE_DATE}</b>. <br/>
Payment will be via <b>bank transfer</b> - given in the body of the invoice. <br/><br/>


Please, confirm the receipt. <br/>
Any questions, we are available. <br/><br/>
  <br/>
  <br/>
Att.,
Customer relationship
</body>
</html>
```

### **Technology**

The connector uses [Freemarker](https://freemarker.apache.org/docs/dgui_template_exp.html) for dynamic content generation.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digibee.com/documentation/connectors-and-triggers/connectors/web-protocols/email-v2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
