# mulesoft Email Connector - Full Documentation
---
product: Email Connector
version: 1.7
---
# Connect to Gmail with Email Connector Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
To connect Anypoint Connector for Email (Email Connector) to your Gmail account, configure a global
element for the IMAPS, POP3S, or SMTPS server connection that you want to use.
For new integrations, use OAuth 2.0 with [Gmail Connector](https://docs.mulesoft.com/gmail-connector/latest/), which is
the preferred Google authentication method for Gmail API access. If you use Email Connector with
username and password, Google requires an app password with 2-Step Verification enabled.
## Configure an App Password in Your Gmail Account
To send emails to a Gmail account via Email Connector, you must
[configure an app password](https://support.google.com/accounts/answer/185833?visit_id=637917932546436561-2352829986&p=InvalidSecondFactor&rd=1)
in your Gmail account.
Use the app password instead of your regular Gmail email password, which enables you to use email
protected by MFA (Multi-Factor Authentication).
## Configure an IMAPS Connection
To connect Email Connector to your Gmail account using an IMAPS connection, configure a global
element:
1. In Studio, navigate to the **Global Elements** view.
2. Click **Create** to open the **Choose Global Type** view.
3. In **Filter**, type `email`, select **Email IMAP**, and click **OK**.
4. In the **Email IMAP** window, for the **Connection** field, select **IMAPS Connection**.
5. In the **General** section, enter the following values:
- **Host** `imap.gmail.com`
- **Port** `993`
- **User** `user@gmail.com`
- **Password** `appPassword`
6. In the **Trust Store Configuration** section, select the **Insecure** checkbox.
7. Click **OK**.

In the **Configuration XML** editor, the configuration looks like this:
```xml
```
## Configure a POP3S Connection
To connect Email Connector to your Gmail account using a POP3S connection, configure a global
element:
1. In Studio, navigate to the **Global Elements** view.
2. Click **Create** to open the **Choose Global Type** view.
3. In **Filter**, type `email`, select **Email POP3**, and click **OK**.
4. In the **Email POP3** window, for the **Connection** field, select **POP3S Connection**.
5. In the **General** section, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user@gmail.com`
- **Password** `appPassword`
6. In the **Trust Store Configuration** section, select the **Insecure** checkbox.
7. Click **OK**.

In the **Configuration XML** editor, the configuration looks like this:
```xml
```
## Configure an SMTP Connection
To connect Email Connector to your Gmail account using an SMTPS connection, configure a global
element:
1. In Studio, navigate to the **Global Elements** view.
2. Click **Create** to open the **Choose Global Type** view.
3. In **Filter**, type `email`, select **Email SMTP**, and click **OK**.
4. In the **Email SMTP** window, for the **Connection** field, select **SMTPS Connection**.
5. In the **General** section, enter the following values:
- **Host** `smtp.gmail.com`
- **Port** `465`
- **User** `user@gmail.com`
- **Password** `appPassword`
6. In the **Trust Store Configuration** section, select the **Insecure** checkbox.
7. Click **OK**.

In the **Configuration XML** editor, the configuration looks like this:
```xml
```
## Troubleshoot SMTPS Connection Issues
Google no longer supports the Less Secure Apps setting for Gmail accounts.
If SMTP authentication fails when you use Email Connector with Gmail:
- Verify that 2-Step Verification is enabled for the Gmail account.
- Generate an app password and use that password in your Email Connector configuration.
- Confirm that you’re not using your normal Gmail account password.
For details, see [Sign in using app passwords](https://support.google.com/accounts/answer/185833).
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/1.7/email-examples)
- [Gmail Connector Overview](https://docs.mulesoft.com/gmail-connector/latest/)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# Connect to Gmail with Email Connector Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
To connect Anypoint Connector for Email (Email Connector) to your Gmail account, configure a global
element for the IMAPS, POP3S, or SMTPS server connection that you want to use.
For new integrations, use OAuth 2.0 with [Gmail Connector](https://docs.mulesoft.com/gmail-connector/latest/), which is
the preferred Google authentication method for Gmail API access. If you use Email Connector with
username and password, Google requires an app password with 2-Step Verification enabled.
## Configure an App Password in Your Gmail Account
To send emails to a Gmail account via Email Connector, you must
[configure an app password](https://support.google.com/accounts/answer/185833?visit_id=637917932546436561-2352829986&p=InvalidSecondFactor&rd=1)
in your Gmail account.
Use the app password instead of your regular Gmail email password, which enables you to use email
protected by MFA (Multi-Factor Authentication).
## Configure an IMAPS Connection
To connect Email Connector to your Gmail account using an IMAPS connection, configure a global
element:
1. In Studio, navigate to the **Global Elements** view.
2. Click **Create** to open the **Choose Global Type** view.
3. In **Filter**, type `email`, select **Email IMAP**, and click **OK**.
4. In the **Email IMAP** window, for the **Connection** field, select **IMAPS Connection**.
5. In the **General** section, enter the following values:
- **Host** `imap.gmail.com`
- **Port** `993`
- **User** `user@gmail.com`
- **Password** `appPassword`
6. In the **Trust Store Configuration** section, select the **Insecure** checkbox.
7. Click **OK**.

In the **Configuration XML** editor, the configuration looks like this:
```xml
```
## Configure a POP3S Connection
To connect Email Connector to your Gmail account using a POP3S connection, configure a global
element:
1. In Studio, navigate to the **Global Elements** view.
2. Click **Create** to open the **Choose Global Type** view.
3. In **Filter**, type `email`, select **Email POP3**, and click **OK**.
4. In the **Email POP3** window, for the **Connection** field, select **POP3S Connection**.
5. In the **General** section, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user@gmail.com`
- **Password** `appPassword`
6. In the **Trust Store Configuration** section, select the **Insecure** checkbox.
7. Click **OK**.

In the **Configuration XML** editor, the configuration looks like this:
```xml
```
## Configure an SMTP Connection
To connect Email Connector to your Gmail account using an SMTPS connection, configure a global
element:
1. In Studio, navigate to the **Global Elements** view.
2. Click **Create** to open the **Choose Global Type** view.
3. In **Filter**, type `email`, select **Email SMTP**, and click **OK**.
4. In the **Email SMTP** window, for the **Connection** field, select **SMTPS Connection**.
5. In the **General** section, enter the following values:
- **Host** `smtp.gmail.com`
- **Port** `465`
- **User** `user@gmail.com`
- **Password** `appPassword`
6. In the **Trust Store Configuration** section, select the **Insecure** checkbox.
7. Click **OK**.

In the **Configuration XML** editor, the configuration looks like this:
```xml
```
## Troubleshoot SMTPS Connection Issues
Google no longer supports the Less Secure Apps setting for Gmail accounts.
If SMTP authentication fails when you use Email Connector with Gmail:
- Verify that 2-Step Verification is enabled for the Gmail account.
- Generate an app password and use that password in your Email Connector configuration.
- Confirm that you’re not using your normal Gmail account password.
For details, see [Sign in using app passwords](https://support.google.com/accounts/answer/185833).
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/latest/email-examples)
- [Gmail Connector Overview](https://docs.mulesoft.com/gmail-connector/latest/)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
---
# Count Messages with Email Connector
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Anypoint Connector for Email (Email Connector) provides the **Count messages - IMAP** and **Count
messages - POP3** operations, which get the total amount of messages in a specified mailbox folder.
## Configure Count Messages - IMAP Operation
The following example shows how to configure the **Count messages - IMAP** operation:
1. Create a new Mule project in Studio.
2. Drag an HTTP **Listener** source to the canvas.
3. On the **Listener** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
4. Configure the required HTTP **Listener** connection fields and click **OK**.
5. Set **Path** to `/count`.
6. Drag the **Count messages - IMAP** operation to the right of HTTP **Listener**.
7. On the **Count messages - IMAP** configuration screen, click the plus sign (**+**) next to the
**Connector configuration** field to configure a global element for the operation.
8. Set the following fields:
- **Host**: `192.168.0.1`
- **User**: `usertest`
- **Host**: `userpass`
9. Click **OK**.
10. For **Mailbox folder**, click **fx** to switch to literal mode and set it to
`vars.mailboxFolder`.
11. Set **Count filter** to any of the following options:
- **ALL (Default)**
- **DELETED**
- **NEW**
- **UNREAD**

In the **Configuration XML** editor, the `email:count-messages-imap` configuration looks like this:
```xml
```
## Configure Count Messages - POP3 Operation
The following example shows how to configure the **Count messages - POP3** operation:
1. Create a new Mule project in Studio.
2. Drag an HTTP **Listener** source to the canvas.
3. On the **Listener** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
4. Configure the required HTTP **Listener** connection fields and click **OK**.
5. Set **Path** to `/count`.
6. Drag the **Count messages - POP3** operation to the right of HTTP **Listener**.
7. On the **Count messages - POP3** configuration screen, click the plus sign (**+**) next to the
**Connector configuration** field to configure a global element for the operation.
8. Set the following fields:
- **Host**: `192.168.0.1`
- **User**: `usertest`
- **Host**: `userpass`

In the **Configuration XML** editor, the `email:count-messages-pop3` configuration looks like this:
```xml
```
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/1.7/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# Count Messages with Email Connector
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Anypoint Connector for Email (Email Connector) provides the **Count messages - IMAP** and **Count
messages - POP3** operations, which get the total amount of messages in a specified mailbox folder.
## Configure Count Messages - IMAP Operation
The following example shows how to configure the **Count messages - IMAP** operation:
1. Create a new Mule project in Studio.
2. Drag an HTTP **Listener** source to the canvas.
3. On the **Listener** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
4. Configure the required HTTP **Listener** connection fields and click **OK**.
5. Set **Path** to `/count`.
6. Drag the **Count messages - IMAP** operation to the right of HTTP **Listener**.
7. On the **Count messages - IMAP** configuration screen, click the plus sign (**+**) next to the
**Connector configuration** field to configure a global element for the operation.
8. Set the following fields:
- **Host**: `192.168.0.1`
- **User**: `usertest`
- **Host**: `userpass`
9. Click **OK**.
10. For **Mailbox folder**, click **fx** to switch to literal mode and set it to
`vars.mailboxFolder`.
11. Set **Count filter** to any of the following options:
- **ALL (Default)**
- **DELETED**
- **NEW**
- **UNREAD**

In the **Configuration XML** editor, the `email:count-messages-imap` configuration looks like this:
```xml
```
## Configure Count Messages - POP3 Operation
The following example shows how to configure the **Count messages - POP3** operation:
1. Create a new Mule project in Studio.
2. Drag an HTTP **Listener** source to the canvas.
3. On the **Listener** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
4. Configure the required HTTP **Listener** connection fields and click **OK**.
5. Set **Path** to `/count`.
6. Drag the **Count messages - POP3** operation to the right of HTTP **Listener**.
7. On the **Count messages - POP3** configuration screen, click the plus sign (**+**) next to the
**Connector configuration** field to configure a global element for the operation.
8. Set the following fields:
- **Host**: `192.168.0.1`
- **User**: `usertest`
- **Host**: `userpass`

In the **Configuration XML** editor, the `email:count-messages-pop3` configuration looks like this:
```xml
```
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/latest/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
---
# Email Connector 1.7
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Support Category:
[Select](https://www.salesforce.com/en-us/wp-content/uploads/sites/4/documents/legal/Agreements/versioning-back-support-policy.pdf)
Anypoint Connector for Email (Email Connector) sends and retrieves email messages over standard
email protocols. Email Connector configurations share a basic set of parameters that require a
connection over the protocols you use.
For compatibility information and fixed issues, see the Email Connector Release Notes.
## Before You Begin
To use this connector, you must be familiar with:
- Anypoint Connectors
- Mule runtime engine (Mule)
- Elements and global elements in a Mule flow
- Creating a Mule app using Anypoint Studio or Anypoint Code Builder
Before creating an app, you must have access to Anypoint Platform and Anypoint Studio.
## Common Use Cases for the Connector
Email Connector enables you to:
- Retrieve emails from POP3 mailboxes
- Retrieve, delete, move and store emails from IMAP mailboxes
- Send emails over the SMTP protocol
- Support secure connections for all protocols over Transport Layer Security (TLS)
For examples, see [Examples](https://docs.mulesoft.com/email-connector/1.7/email-examples).
## Next Step
After you complete the prerequisites and try the templates and examples, you are ready to create
your own app and configure the connector using [Anypoint Studio](https://docs.mulesoft.com/email-connector/1.7/email-studio-configuration).
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# Email Connector 1.8
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Support Category:
[Select](https://www.salesforce.com/en-us/wp-content/uploads/sites/4/documents/legal/Agreements/versioning-back-support-policy.pdf)
Anypoint Connector for Email (Email Connector) sends and retrieves email messages over standard
email protocols. Email Connector configurations share a basic set of parameters that require a
connection over the protocols you use.
For compatibility information and fixed issues, see the Email Connector Release Notes.
## Before You Begin
To use this connector, you must be familiar with:
- Anypoint Connectors
- Mule runtime engine (Mule)
- Elements and global elements in a Mule flow
- Creating a Mule app using Anypoint Studio or Anypoint Code Builder
Before creating an app, you must have access to Anypoint Platform and Anypoint Studio.
## Common Use Cases for the Connector
Email Connector enables you to:
- Retrieve emails from POP3 mailboxes
- Retrieve, delete, move and store emails from IMAP mailboxes
- Send emails over the SMTP protocol
- Support secure connections for all protocols over Transport Layer Security (TLS)
For examples, see [Examples](https://docs.mulesoft.com/email-connector/latest/email-examples).
## Next Step
After you complete the prerequisites and try the templates and examples, you are ready to create
your own app and configure the connector using [Anypoint Studio](https://docs.mulesoft.com/email-connector/latest/email-studio-configuration).
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
keywords: anypoint, connectors, transports
---
# Email Connector Examples 1.6
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
To fully benefit from using Anypoint Connector for Email (Email Connector), see the following
examples to configure the connector.
- [Send Emails and Attachments](https://docs.mulesoft.com/email-connector/1.7/email-send)
Configure the **Send** operation to send emails and attachments over SMTP or SMTPS servers.
- [List Emails](https://docs.mulesoft.com/email-connector/1.7/email-list)
Configure Email Connector and IMAP or POP3 protocols to list emails.
- [Connect to Gmail](https://docs.mulesoft.com/email-connector/1.7/email-gmail)
Configure Email Connector and IMAP, POP3, and SMTP protocols to connect to your Gmail account.
- [Trigger a Flow When Receiving a New Email](https://docs.mulesoft.com/email-connector/1.7/email-trigger)
Configure the **On New Email - IMAP** or **On New Email - POP3** sources to retrieve all the
emails in an IMAP or POP3 mailbox, and generate a new message for each unread email found.
Additionally, configure the **Delete After Retrieve**, **Enable Watermark**, **IMAP Matcher** or
**POP3 Matcher**, **Attachment Naming Strategy**, and **Enable Remote Search** parameters for
these sources.
- [Set Parsing Text File Attachment as Body Message](https://docs.mulesoft.com/email-connector/1.7/email-attachment)
Set the system property `parsing.text.attachment.as.body` to change the behavior of parsing
attached text files when the file is the only content in the message.
- [Move Messages Between Folders for IMAP/S Connection Providers](https://docs.mulesoft.com/email-connector/1.7/email-move-folder)
Configure the **Move to folder** operation to move messages between folders for IMAP and IMAPS
connection providers.
- [Count messages with Email Connector](https://docs.mulesoft.com/email-connector/1.7/email-connector-count-messages)
Configure the **Count messages - IMAP** and **Count messages - POP3** operations get the total
amount of messages in a specified mailbox folder.
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
keywords: anypoint, connectors, transports
---
# Email Connector Examples 1.6
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
To fully benefit from using Anypoint Connector for Email (Email Connector), see the following
examples to configure the connector.
- [Send Emails and Attachments](https://docs.mulesoft.com/email-connector/latest/email-send)
Configure the **Send** operation to send emails and attachments over SMTP or SMTPS servers.
- [List Emails](https://docs.mulesoft.com/email-connector/latest/email-list)
Configure Email Connector and IMAP or POP3 protocols to list emails.
- [Connect to Gmail](https://docs.mulesoft.com/email-connector/latest/email-gmail)
Configure Email Connector and IMAP, POP3, and SMTP protocols to connect to your Gmail account.
- [Trigger a Flow When Receiving a New Email](https://docs.mulesoft.com/email-connector/latest/email-trigger)
Configure the **On New Email - IMAP** or **On New Email - POP3** sources to retrieve all the
emails in an IMAP or POP3 mailbox, and generate a new message for each unread email found.
Additionally, configure the **Delete After Retrieve**, **Enable Watermark**, **IMAP Matcher** or
**POP3 Matcher**, **Attachment Naming Strategy**, and **Enable Remote Search** parameters for
these sources.
- [Set Parsing Text File Attachment as Body Message](https://docs.mulesoft.com/email-connector/latest/email-attachment)
Set the system property `parsing.text.attachment.as.body` to change the behavior of parsing
attached text files when the file is the only content in the message.
- [Move Messages Between Folders for IMAP/S Connection Providers](https://docs.mulesoft.com/email-connector/latest/email-move-folder)
Configure the **Move to folder** operation to move messages between folders for IMAP and IMAPS
connection providers.
- [Count messages with Email Connector](https://docs.mulesoft.com/email-connector/latest/email-connector-count-messages)
Configure the **Count messages - IMAP** and **Count messages - POP3** operations get the total
amount of messages in a specified mailbox folder.
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
---
# Email Connector Reference 1.7
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Support Category:
[Select](https://www.salesforce.com/en-us/wp-content/uploads/sites/4/documents/legal/Agreements/versioning-back-support-policy.pdf)
Anypoint Connector for Email (Email Connector ) is used to list and send emails and perform
operations in different mailboxes, such as `delete` and `mark as read`.
Email Connector supports the SMTP, SMTPS, IMAP, IMAPS, POP3, and POP3s protocols.
## Configurations
### IMAP
Configuration for operations that are performed through the IMAP (Internet Message Access Protocol)
protocol.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Name | | Name for this configuration. Connectors reference the configuration with this name. | | |
Connection | | Connection types for this configuration | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Enables you to specify a strategy for how to name attachments | | |
Eagerly Fetch Content | | Indicates whether to open and read the retrieved emails. The default value is "true". | | |
Expiration Policy | | Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration. This does not mean that the instance expires at the exact moment that it becomes eligible. Mule purges the instances when as appropriate. | | |
### Connection Types
### IMAP Connection
A connection provider that returns instances of IMAP-based mailbox connections.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional set of custom properties to configure the connection session | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A Time Unit that qualifies the connectionTimeout, writeTimeout and readTimeout attributes | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with timeoutUnit. | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with timeoutUnit. | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with timeoutUnit. | | |
Host | | Host name of the mail server. | If the Host name value is defined with a property name and the value is empty, then it defaults to the localhost value. | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy. | | |
Pooling Profile | | Characteristics of the connection pool | | |
### IMAPS Connection
A connection provider that returns instances of IMAPs (secure) based mailbox connections.
The returned connection is secured by TLS.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional set of custom properties to configure the connection session. | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A time unit that qualifies the connectionTimeout, writeTimeout and readTimeout attributes. | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with timeoutUnit. | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with #timeoutUnit. | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with #timeoutUnit | | |
Host | | Host name of the mail server | If the Host name value is defined with a property name and the value is empty, then it defaults to the localhost value. | |
User | | Username used to connect with the mail server | | |
Password | | Username password to connect with the mail server | | |
Port | | The port number of the mail server | | |
TLS Configuration | | TLS Configuration for the secure connection of the IMAPS protocol | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy. | | |
Pooling Profile | | Characteristics of the connection pool | | |
## Operations
- [Delete](#delete)
- [Expunge Folder](#expungeFolder)
- [List - IMAP](#listImap)
- [Mark As Deleted](#markAsDeleted)
- [Mark As Read](#markAsRead)
- [Move To Folder](#moveToFolder)
### Associated Sources
- [On New Email - IMAP](#listener-imap)
### POP3
Configuration for operations that are performed through the POP3 (Post Office Protocol 3) protocol.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Name | | Name for this configuration. Connectors reference the configuration with this name. | | |
Connection | | Connection types for this configuration | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Enables you to specify a strategy for how to name attachments | | |
Expiration Policy | | Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration. This does not mean that the instance expires at the exact moment that it becomes eligible. Mule purges the instances when appropriate. | | |
### Connection Types
#### POP3 Connection
A connection provider that returns instances of POP-based mailbox connections.
##### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional set of custom properties to configure the connection session | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A time unit that qualifies the connectionTimeout, writeTimeout and readTimeout attributes. | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with timeoutUnit. | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with timeoutUnit. | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with timeoutUnit. | | |
Host | | Host name of the mail server. | If the Host name value is defined with a property name and the value is empty, then it defaults to the localhost value. | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy. | | |
Pooling Profile | | Characteristics of the connection pool | | |
##### POP3S Connection
A connection provider that returns instances of POP3s (secured) based mailbox connections. The
returned connection is secured by TLS.
###### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional set of custom properties to configure the connection session | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A TimeUnit which qualifies the connectionTimeout, writeTimeout and readTimeout attributes. | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with timeoutUnit. | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with timeoutUnit. | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with timeoutUnit. | | |
Host | | Host name of the mail server | If the Host name value is defined with a property name and the value is empty, then it defaults to the localhost value. | |
User | | Username used to connect with the mail server | | |
Password | | Username password to connect with the mail server | | |
Port | | The port number of the mail server | | |
TLS Configuration | | TLS configuration for the secure connection of the POP3S protocol | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy. | | |
Pooling Profile | | Characteristics of the connection pool | | |
### Supported Operations
- [List - POP3](#listPop3)
#### Associated Sources
- [On New Email - POP3](#listener-pop3)
---
### SMTP
Configuration for operations that are performed through the SMTP (Simple Mail Transfer Protocol)
protocol.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Name | | Name for this configuration. Connectors reference the configuration with this name. | | |
Connection | | Connection types for this configuration. | | |
From | | The "From" address of the message sender | | |
Default Encoding | | Default character encoding to use in all the messages. If not specified, the default charset in the Mule configuration is used. | | |
Default Content Transfer Encoding | | | | |
Expiration Policy | | Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration. This does not mean that the instance expires at the exact moment that it becomes eligible. Mule purges the instances when appropriate. | | |
#### Connection Types
##### SMTP Connection
A connection provider that returns instances of SMTP-based sender connections.
###### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional set of custom properties to configure the connection session | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A TimeUnit that qualifies the connectionTimeout, writeTimeout and readTimeout attributes. | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with timeoutUnit. | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with timeoutUnit. | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with timeoutUnit. | | |
Host | | Host name of the mail server. | If the Host name value is defined with a property name and the value is empty, then it defaults to the localhost value. | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy. | | |
Pooling Profile | | Characteristics of the connection pool | | |
##### SMTPS Connection
A connection provider that returns instances of SMTPS-based mailbox connections. The returned
connection is secured by TLS.
###### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional set of custom properties to configure the connection session | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A TimeUnit which qualifies the connectionTimeout, writeTimeout and readTimeout attributes. | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with timeoutUnit. | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with timeoutUnit. | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with timeoutUnit. | | |
Host | | Host name of the mail server. | If the Host name value is defined with a property name and the value is empty, then it defaults to the localhost value. | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. | | |
TLS Configuration | | TLS Configuration for the secure connection of the SMTPS protocol | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy. | | |
Pooling Profile | | Characteristics of the connection pool | | |
### Supported Operations
- [Send](#send)
### Operations
### Count messages - IMAP
``
Counts the emails in the mailboxFolder.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | String | Name of the configuration to use. | | X |
Mailbox Folder | | Mailbox folder where the emails are. | INBOX | |
Count Filter | | Count only messages specified with this option. | ALL | |
Target Variable | | Name of a variable to store the operation’s output. | | |
Target Value | | An expression that evaluates the operation’s output. The expression outcome is stored in the Target Variable | #[payload]
| |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
#### Output
#### For Configurations.
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_COUNT\_MESSAGES
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Delete
``
Deletes the email with the specified email ID from the mailbox.
For IMAP mailboxes, all the messages scheduled for deletion (marked as `DELETED`) are also erased
from the folder.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Mailbox folder from which to delete the emails | | |
Email ID | | Email ID number of the email to delete | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_NOT\_FOUND
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Expunge Folder
``
Deletes all the messages scheduled for deletion with the `DELETED` flag set from the mailbox.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Mailbox folder where the emails with the DELETED flag are scheduled to be permanently deleted | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### List - IMAP
``
List all the emails (with pagination) in the configured IMAP mailbox folder that matches with the
specified IMAP matcher criteria.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use.. | | |
Mailbox Folder | | Mailbox folder from which to fetch the emails | | |
Match with | | Email Matcher that gives the capability of filtering the retrieved emails | | |
Delete After Retrieve | | Specifies whether to delete the returned emails after they are retrieved | | |
Page Size | | Size of the page used by the Paging Provider implementation for fetching the emails from the IMAP server | | |
Pagination Offset | | Size of the pagination offset used by the paging provider implementation for fetching the emails from the IMAP server. | | |
Limit | | Maximum number of emails retrieved by the operation. Take into account that this limit applies only to the emails effectively retrieved by the operation (the emails that match the IMAPEmailPredicateBuilder criteria) and doesn’t imply any restrictions for the amount of emails that are retrieved from the mailbox server. | | |
Streaming Strategy | | Configure how Mule processes streams with streaming strategies. Repeatable streams are the default behavior. | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Enables you to specify a strategy for how to name attachments | | |
Target Variable | | The name of a variable to store the operation’s output | | |
Target Value | | An expression that evaluates the operation’s output. The expression outcome is stored in the Target Variable | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
#### Output
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_LIST
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
### Mark As Deleted
``
Marks an incoming email as `DELETED`. Emails that are marked for deletion are scheduled for deletion
when the folder closes, which means that the email is not physically eliminated from the mailbox
folder, but its state changes. All emails that are marked as `DELETED` are eliminated from the
mailbox when `IMAPOperations#expungeFolder(MailboxConnection, String)` or
`IMAPOperations#delete(MailboxConnection, String, long)` is executed. This operation targets a
single email.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use.. | | |
Mailbox Folder | | Mailbox folder where the emails are going to be marked as deleted | | |
Email ID | | Email ID number of the email to mark as deleted. | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_NOT\_FOUND
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Mark As Read
``
Marks a single email as `READ` changing its state in the specified mailbox folder. This operation
can target a single email.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Folder where the emails are going to be marked as read | | |
Email ID | | Email ID number of the email to mark as read. | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
### For Configurations
- [IMAP](#imap) ==== Throws
- EMAIL:EMAIL\_NOT\_FOUND
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Move To Folder
`` Moves the email with ID `emailId` from the source folder to the target
folder.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Source Folder | | Source mailbox folder where emails to move are located. | | |
Target Folder | | Target mailbox folder where emails are moved. | | |
Email ID | | Email ID number of the email to move. | | |
Create Target Folder | | Creates the target folder if the folder does not exist. | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_NOT\_FOUND
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Count messages - POP3
``
Counts the emails in the INBOX\_FOLDER.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | String | Name of the configuration to use. | | X |
Target Variable | | The name of a variable to store the operation’s output | | |
Target Value | | An expression that evaluates the operation’s output. The expression outcome is stored in the Target Variable | #[payload]
| |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
#### Output
#### For Configurations.
- [POP3](#pop3)
#### Throws
- EMAIL:EMAIL\_COUNT\_MESSAGES
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### List - POP3
``
Lists all the emails (with pagination) in the configured POP3 mailbox folder that matches the
specified POP3 Matcher criteria. The POP3 protocol does not support finding a specific email from
its UID in a folder to move or delete it, so a `deleteAfterRetrieve` parameter is available for
deleting the emails from the server immediately after retrieval.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use.. | | |
Mailbox Folder | | Mailbox folder from which to fetch the emails | | |
Match with | | Email Matcher that gives the capability of filtering the retrieved emails | | |
Delete After Retrieve | | Specifies whether to delete the returned emails after they are retrieved | | |
Page Size | | Size of the page used by the Paging Provider implementation for fetching the emails from the POP3 server | | |
Pagination Offset | | Size of the pagination offset used by the paging provider implementation for fetching the emails from the POP3 server. | | |
Limit | | Maximum number of emails retrieved by the operation. Take into account that this limit applies only to the emails effectively retrieved by the operation (the emails that matched the IMAPEmailPredicateBuilder criteria) and doesn’t imply any restriction over the number of emails that are retrieved from the mailbox server. | | |
Streaming Strategy | | Configure to use repeatable streams. | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Enables you to specify a strategy for how to name attachments | | |
Target Variable | | The name of a variable to store the operation’s output. | | |
Target Value | | An expression that evaluates the operation’s output. The expression outcome is stored in the Target Variable | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
#### Output
### For Configurations
- [POP3](#pop3)
#### Throws
- EMAIL:EMAIL\_LIST
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
### Send
``
This operation sends an email message. The message is sent to all recipient (`To`, `CC`, and `BCC`)
addresses specified in the message. The content of the message is some type of text (`text/plain`,
`text/html`) and is composed of the body and its content type. If no content is specified then the
incoming payload is converted into plain text if possible.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
From Address | | The "From" address of the message sender. If not set, it defaults to the "From" address specified in the config. | | |
To Addresses | | The recipient addresses of "To" (primary) type | | |
Cc Addresses | | The recipient addresses of "CC" (carbon copy) type | | |
Bcc Addresses | | The recipient addresses of "BCC" (blind carbon copy) type | | |
Reply To Addresses | | The email addresses to which to reply to this email | | |
Subject | | | | |
Headers | | The headers that this email carries | | |
Content | | Text body of the message, which can be in any format | | |
ContentType | | Content Type of the body text. Example: "text/plain" | | |
Encoding | | The character encoding of the body. If it is configured, it overrides the one inferred from the body. | | |
Attachments | | The attachments that are sent along with the email body | | |
Content Transfer Encoding | | Encoding used to indicate the type of transformation that is used to represent the body in an acceptable manner for transport. The value is case insensitive. Known encodings: BASE64, QUOTED-PRINTABLE, 8BIT, 7BIT, BINARY | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
### For Configurations
- [SMTP](#smtp)
#### Throws
- EMAIL:SEND
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
## Sources
### On New Email - IMAP
``
Retrieves all the emails from an IMAP mailbox folder, watermark can be enabled for polled items.
Note that Email Connector currently doesn’t support multipart/signed (digitally signed) emails, and
they are not processed by **On New Email** listeners.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use.. | | |
Folder | | The name of the folder to poll emails from. | | |
Delete After Retrieve | | Specifies whether to delete the returned emails after they are retrieved | | |
Enable Watermark | | Specifies wether to apply watermark to the polled emails. | | |
Imap Matcher | | A matcher to filter emails retrieved by this polling source. By default, already-read emails will be filtered. | | |
Enable Remote Search | | If search filters should be resolved on the server side, set this value to true. The default is false, which means search filters are resolved on the client side. This is because some email servers are not fully compliant with rfc-3501 search terms. Activating this feature diminishes traffic by reducing the number of emails sent to the client side for processing. | | |
Primary Node Only | | Whether to execute this source on the primary node only when running in cluster mode | | |
Scheduling Strategy | | Configures the scheduler that triggers the polling | | |
Redelivery Policy | | Defines a policy for processing the redelivery of the same message | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Enables you to specify a strategy for how to name attachments | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
#### Output
### For Configurations
- [IMAP](#imap)
### On New Email - POP3
``
Retrieves all the emails from an POP3 mailbox folder.
Note that Email Connector currently doesn’t support multipart/signed (digitally signed) emails, and
they are not processed by **On New Email** listeners.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Folder | | The name of the folder to poll emails from | | |
Delete After Retrieve | | Specifies whether to delete the returned emails after they are retrieved | | |
Pop3 Matcher | | A matcher to filter emails retrieved by this polling source | | |
Primary Node Only | | Whether to execute this source on the primary node only when running in cluster mode | | |
Scheduling Strategy | | Configures the scheduler that triggers the polling | | |
Redelivery Policy | | Defines a policy for processing the redelivery of the same message | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Enables you to specify a strategy for how to name attachments | | |
Reconnection Strategy | | Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs. | | |
#### Output
### For Configurations
- [POP3](#pop3)
### Types
### Reconnection
| Field | Type | Description | Default Value | Required |
|---|
Fails Deployment | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy. | | |
Reconnection Strategy | | The reconnection strategy to use | | |
### Reconnect
| Field | Type | Description | Default Value | Required |
|---|
Frequency | | How often in milliseconds to reconnect. | | |
Count | | How many reconnection attempts to make. | | |
blocking | Boolean | If false, the reconnection strategy runs in a separate, non-blocking thread. | true | |
### Reconnect Forever
| Field | Type | Description | Default Value | Required |
|---|
Frequency | | How often in milliseconds to reconnect. | | |
blocking | Boolean | If false, the reconnection strategy runs in a separate, non-blocking thread. | true | |
### Pooling Profile
| Field | Type | Description | Default Value | Required |
|---|
Max Active | | Controls the maximum number of Mule components that can be borrowed from a session at one time. When set to a negative value, there is no limit to the number of components that can be active at one time. When maxActive is exceeded, the pool is said to be exhausted. | | |
Max Idle | | Controls the maximum number of Mule components that can sit idle in the pool at any time. When set to a negative value, there is no limit to the number of Mule components that can be idle at one time. | | |
Max Wait | | Specifies the number of milliseconds to wait for a pooled component to become available when the pool is exhausted and the exhaustedAction is set to WHEN_EXHAUSTED_WAIT. | | |
Min Eviction Millis | | Determines the minimum amount of time an object can sit idle in the pool before it is eligible for eviction. When the value is a negative number, no objects are evicted from the pool due to idle time alone. | | |
Eviction Check Interval Millis | | Specifies the number of milliseconds between runs of the object evictor. When this value is set to a negative number, no object evictor is executed. | | |
Exhausted Action | WHEN_EXHAUSTED_GROW WHEN_EXHAUSTED_WAIT WHEN_EXHAUSTED_FAIL
| Specifies the behavior of the Mule component pool when the pool is exhausted. Possible values are: WHEN_EXHAUSTED_FAIL, which will throw a NoSuchElementException, WHEN_EXHAUSTED_WAIT, which will block by invoking Object.wait(long) until a new or idle object is available, or WHEN_EXHAUSTED_GROW, which will create a new Mule instance and return it, essentially making maxActive meaningless. If a positive maxWait value is supplied, it will block for, at most, that many milliseconds, after which a NoSuchElementException is thrown. If maxThreadWait is a negative value, it blocks indefinitely. | | |
Initialisation Policy | INITIALISE_NONE INITIALISE_ONE INITIALISE_ALL
| Determines how components in a pool should be initialized. The possible values are: INITIALISE_NONE (loads no components into the pool on startup), INITIALISE_ONE (loads one initial component into the pool on startup), or INITIALISE_ALL (loads all components in the pool on startup) | | |
Disabled | | Whether pooling should be disabled | | |
### TlS
| Field | Type | Description | Default Value | Required |
|---|
Enabled Protocols | | A comma-separated list of protocols enabled for this context | | |
Enabled Cipher Suites | | A comma-separated list of cipher suites enabled for this context | | |
Trust Store | | | | |
Key Store | | | | |
Revocation Check | | | | |
### Trust Store
| Field | Type | Description | Default Value | Required |
|---|
Path | | The location (which will be resolved relative to the current classpath and file system, if possible) of the trust store | | |
Password | | The password used to protect the trust store | | |
Type | | | | |
Algorithm | | The algorithm used by the trust store | | |
Insecure | | If true, no certificate validations are performed, which makes connections vulnerable to attacks. Use at your own risk. | | |
### Key Store
| Field | Type | Description | Default Value | Required |
|---|
Path | | The location (which is resolved relative to the current classpath and file system, if possible) of the key store | | |
Type | | | | |
Alias | | When the key store contains many private keys, this attribute indicates the alias of the key that should be used. If not defined, the first key in the file will be used by default. | | |
Key Password | | The password used to protect the private key | | |
Password | | The password used to protect the key store | | |
Algorithm | | The algorithm used by the key store | | |
### Standard Revocation Check
| Field | Type | Description | Default Value | Required |
|---|
Only End Entities | | Verify only the last element of the certificate chain | | |
Prefer Crls | | Try CRL instead of OCSP first | | |
No Fallback | | Do not use the secondary checking method (the one not selected before) | | |
Soft Fail | | Avoid verification failure when the revocation server cannot be reached or is busy | | |
### Custom OCSP Responder
| Field | Type | Description | Default Value | Required |
|---|
Url | | The URL of the OCSP responder | | |
Cert Alias | | Alias of the signing certificate for the OCSP response (must be in the trust store), if present | | |
### CRL File
| Field | Type | Description | Default Value | Required |
|---|
Path | | The path to the CRL file. | | |
### Expiration Policy
| Field | Type | Description | Default Value | Required |
|---|
Max Idle Time | | A scalar time value for the maximum amount of time a dynamic configuration instance should be allowed to be idle before it’s considered eligible for expiration | | |
Time Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A time unit that qualifies the maxIdleTime attribute | | |
### Stored Email Content
| Field | Type | Description | Default Value | Required |
|---|
Body | | | | |
Attachments | | | | |
### Base Email Attributes
| Field | Type | Description | Default Value | Required |
|---|
Number | | | | |
From Addresses | | | | |
To Addresses | | | | |
Cc Addresses | | | | |
Bcc Addresses | | | | |
Reply To Addresses | | | | |
Headers | | | | |
Subject | | | | |
Received Date | | | | |
Sent Date | | | | |
### IMAP Matcher
| Field | Type | Description | Default Value | Required |
|---|
Seen | | Indicates whether to retrieve 'seen' or 'not seen' emails | | |
Answered | | Indicates whether to retrieve 'answered' or 'not answered' emails | | |
Deleted | | Indicates whether to retrieve 'marked as deleted' or 'not marked as deleted' emails | | |
Recent | | Indicates whether to retrieve recent or not recent emails | | |
Received Since | | Indicates the date after which to retrieve received emails | | |
Received Until | | Indicates the date until which to retrieve the received emails | | |
Sent Since | | Indicates the date after which to retrieve sent emails | | |
Sent Until | | Indicates the date until which to retrieve sent emails | | |
Subject Regex | | Subject Regex to match with the wanted emails | | |
From Regex | | From Email Address Regex to match with the wanted emails | | |
### Redelivery Policy
| Field | Type | Description | Default Value | Required |
|---|
Max Redelivery Count | | The maximum number of times a message can be redelivered and processed unsuccessfully before triggering process-failed-message | | |
Use Secure Hash | | Whether to use a secure hash algorithm to identify a redelivered message | | |
Message Digest Algorithm | | The secure hashing algorithm to use. If not set, the default is SHA-256. | | |
Id Expression | | Defines one or more expressions to use to determine when a message has been redelivered. This property can be set only if Use secure hash is false. | | |
Object Store | | The object store in which to store the redelivery counter for each message. | | |
### IMAP Email Attributes
| Field | Type | Description | Default Value | Required |
|---|
Flags | | | | |
Id | | | | |
Number | | | | |
From Addresses | | | | |
To Addresses | | | | |
Cc Addresses | | | | |
Bcc Addresses | | | | |
Reply To Addresses | | | | |
Headers | | | | |
Subject | | | | |
Received Date | | | | |
Sent Date | | | | |
### Email Flags
| Field | Type | Description | Default Value | Required |
|---|
Answered | | | | |
Deleted | | | | |
Draft | | | | |
Recent | | | | |
Seen | | | | |
### Repeatable in Memory Iterable
| Field | Type | Description | Default Value | Required |
|---|
Initial Buffer Size | | The number of instances that are initially allowed to be kept in memory to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the bufferSizeIncrement attribute, with an upper limit of maxInMemorySize. Default value is 100 instances. | | |
Buffer Size Increment | | This is by how much the buffer size expands if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full. Default value is 100 instances. | | |
Max Buffer Size | | The maximum amount of memory to use. If more than that is used then a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to zero means no limit. | | |
### Repeatable File Store Iterable
| Field | Type | Description | Default Value | Required |
|---|
In Memory Objects | | The maximum amount of instances that will be kept in memory. If more than that is required, content starts to buffer on disk. | | |
Buffer Unit | | The unit in which maxInMemorySize is expressed | | |
### POP3 Matcher
| Field | Type | Description | Default Value | Required |
|---|
Received Since | | Indicates since which date the received emails must be retrieved | | |
Received Until | | Indicates until which date the received emails must be retrieved | | |
Sent Since | | Indicates since which date the sent emails must be retrieved | | |
Sent Until | | Indicates until which date the sent emails must be retrieved | | |
Subject Regex | | Subject Regex to match with the wanted emails | | |
From Regex | | From Email Address Regex to match with the wanted emails | | |
### POP3 Email Attributes
| Field | Type | Description | Default Value | Required |
|---|
Id | | | | |
Number | | | | |
From Addresses | | | | |
To Addresses | | | | |
Cc Addresses | | | | |
Bcc Addresses | | | | |
Reply To Addresses | | | | |
Headers | | | | |
Subject | | | | |
Received Date | | | | |
Sent Date | | | | |
## See Also
- [Email Connector Release Notes](https://docs.mulesoft.com/release-notes/connector/connector-email)
- [Email Connector](https://www.mulesoft.com/exchange/org.mule.connectors/mule-email-connector/)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# Email Connector Reference 1.8
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Support Category:
[Select](https://www.salesforce.com/en-us/wp-content/uploads/sites/4/documents/legal/Agreements/versioning-back-support-policy.pdf)
Anypoint Connector for Email (Email Connector ) is used to list and send emails and perform
operations in different mailboxes, such as `delete` and `mark as read`.
Email Connector supports the SMTP, SMTPS, IMAP, IMAPS, POP3, and POP3s protocols.
## Configurations
---
### IMAP
Configuration for operations that are performed through the IMAP (Internet Message Access Protocol)
protocol.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Name | | Name for this configuration. Connectors reference the configuration with this name. | | |
Connection | | The connection types to provide to this configuration. | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Indicates how attachment names should be retrieved. | | |
Eagerly Fetch Content | | Indicates whether the retrieved emails should be opened and read. The default value is "true". | | |
Expiration Policy | | Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration. | | |
#### Connection Types
##### IMAP Connection
A ConnectionProvider that returns instances of imap based MailboxConnections.
###### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional custom set of properties to configure the connection session. | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A TimeUnit which qualifies the #connectionTimeout, #writeTimeout and #readTimeout attributes. Defaults to SECONDS | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Host | | Host name of the mail server. | | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. '993' by default. | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy | | |
Pooling Profile | | Characteristics of the connection pool | | |
##### IMAPS Connection
A ConnectionProvider that returns instances of imaps (secure) based MailboxConnections. The returned
connection is secured by TLS.
###### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional custom set of properties to configure the connection session. | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A TimeUnit which qualifies the #connectionTimeout, #writeTimeout and #readTimeout attributes. Defaults to SECONDS | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Host | | Host name of the mail server. | | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. '993' by default. | | |
TLS Configuration | | TLS Configuration for the secure connection of the IMAPS protocol | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy | | |
Pooling Profile | | Characteristics of the connection pool | | |
## Supported Operations
- [Count messages - IMAP](#countMessagesImap)
- [Delete](#delete)
- [Expunge Folder](#expungeFolder)
- [List - IMAP](#listImap)
- [Mark As Deleted](#markAsDeleted)
- [Mark As Read](#markAsRead)
- [Move To Folder](#moveToFolder)
## Associated Sources
- [On New Email - IMAP](#listener-imap)
---
### POP3
Configuration for operations that are performed through the POP3 (Post Office Protocol 3) protocol.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Name | | Name for this configuration. Connectors reference the configuration with this name. | | |
Connection | | The connection types to provide to this configuration. | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Indicates how attachment names should be retrieved. | | |
Expiration Policy | | Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration. | | |
#### Connection Types
##### POP3 Connection
A ConnectionProvider that returns instances of pop3 based MailboxConnections.
###### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional custom set of properties to configure the connection session. | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A TimeUnit which qualifies the #connectionTimeout, #writeTimeout and #readTimeout attributes. Defaults to SECONDS | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Host | | Host name of the mail server. | | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. '110' by default. | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy | | |
Pooling Profile | | Characteristics of the connection pool | | |
##### POP3S Connection
A ConnectionProvider that returns instances of pop3s (secured) based MailboxConnections. The
returned connection is secured by TLS.
###### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional custom set of properties to configure the connection session. | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A TimeUnit which qualifies the #connectionTimeout, #writeTimeout and #readTimeout attributes. Defaults to SECONDS | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Host | | Host name of the mail server. | | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. '995' by default. | | |
TLS Configuration | | TLS Configuration for the secure connection of the POP3S protocol | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy | | |
Pooling Profile | | Characteristics of the connection pool | | |
## Supported Operations
- [Count messages - POP3](#countMessagesPop3)
- [List - POP3](#listPop3)
## Associated Sources
- [On New Email - POP3](#listener-pop3)
---
### SMTP
Configuration for operations that are performed through the SMTP (Simple Mail Transfer Protocol)
protocol.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Name | | Name for this configuration. Connectors reference the configuration with this name. | | |
Connection | | The connection types to provide to this configuration. | | |
From | | The "From" sender address. The person that is going to send the messages. | | |
Default Encoding | | Default character encoding to use in all the messages. If not specified, the default charset in the mule configuration will be used | | |
Default Content Transfer Encoding | | | | |
Expiration Policy | | Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration. | | |
#### Connection Types
##### SMTP Connection
A ConnectionProvider that returns instances of smtp based SenderConnections.
###### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional custom set of properties to configure the connection session. | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A TimeUnit which qualifies the #connectionTimeout, #writeTimeout and #readTimeout attributes. Defaults to SECONDS | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Host | | Host name of the mail server. | | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. '25' by default. | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy | | |
Pooling Profile | | Characteristics of the connection pool | | |
##### SMTPS Connection
A ConnectionProvider that returns instances of smtps based MailboxConnections. The returned
connection is secured by TLS.
###### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Properties | | An additional custom set of properties to configure the connection session. | | |
Timeout Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| A TimeUnit which qualifies the #connectionTimeout, #writeTimeout and #readTimeout attributes. Defaults to SECONDS | | |
Connection Timeout | | The socket connection timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Read Timeout | | The socket read timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Write Timeout | | The socket write timeout value. This attribute works in tandem with #timeoutUnit. Defaults to 5 | | |
Host | | Host name of the mail server. | | |
User | | Username used to connect with the mail server. | | |
Password | | Username password to connect with the mail server. | | |
Port | | The port number of the mail server. '465' by default. | | |
TLS Configuration | | TLS Configuration for the secure connection of the SMTPS protocol | | |
Reconnection | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy | | |
Pooling Profile | | Characteristics of the connection pool | | |
## Supported Operations
- [Send](#send)
## Operations
### Count messages - IMAP
``
Counts the emails in the mailboxFolder.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Mailbox folder where the emails are. | | |
Count Filter | | Count only messages specified with this option. | | |
Target Variable | | Name of the variable that storesoperation’s output will be placed | | |
Target Value | | An expression to evaluate against the operation’s output and store the expression outcome in the target variable | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
#### Output
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_COUNT\_MESSAGES
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Delete
``
Eliminates from the mailbox the email with ID emailId. For IMAP mailboxes all the messages scheduled
for deletion (marked as DELETED) will also be erased from the folder.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Mailbox folder where the emails are going to delete | | |
Email ID | | Email ID Number of the email to delete. | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_NOT\_FOUND
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Expunge Folder
``
Eliminates from the mailbox all the messages scheduled for deletion with the DELETED flag set.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Mailbox folder where the emails with the 'DELETED' flag are going to be scheduled to be definitely deleted | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### List - IMAP
``
List all the emails (with pagination) in the configured imap mailBoxFolder that match with the
specified imapMatcher criteria.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Mailbox folder where the emails are going to be fetched | | |
Match with | | Email Matcher which gives the capability of filter the retrieved emails | | |
Delete After Retrieve | | Specifies if the returned emails must be deleted after being retrieved or not. | | |
Page Size | | Size of the page used by the PagingProvider implementation for fetching the emails from the IMAP server | | |
Pagination Offset | | Size of the pagination offset used by the PagingProvider implementation for fetching the emails from the IMAP server | | |
Limit | | Maximum amount of emails retrieved by the operation. Take into account that this limit only applies to the emails effectively retrieved by the operation (the ones which matched the IMAPEmailPredicateBuilder criteria) and doesn’t imply any restriction over the amount of emails being retrieved from the mailbox server. | | |
Streaming Strategy | | Configures how Mule processes streams. Repeatable streams are the default behavior. | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Indicates how attachment names should be retrieved. | | |
Target Variable | | Name of the variable that storesoperation’s output will be placed | | |
Target Value | | An expression to evaluate against the operation’s output and store the expression outcome in the target variable | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
#### Output
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_LIST
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
### Mark As Deleted
``
Marks an incoming email as DELETED, this way the marked email(s) are scheduled for deletion when the
folder closes, this means that the email is not physically eliminated from the mailbox folder, but
it’s state changes. All DELETED marked emails are going to be eliminated from the mailbox when one
of IMAPOperations#expungeFolder(MailboxConnection, String) or
IMAPOperations#delete(MailboxConnection, String, long) is executed. This operation targets a single
email.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Mailbox folder where the emails are going to be marked as deleted | | |
Email ID | | Email ID Number of the email to mark as deleted. | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_NOT\_FOUND
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Mark As Read
``
Marks a single email as READ changing it’s state in the specified mailbox folder. This operation can
targets a single email.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Folder where the emails are going to be marked as read | | |
Email ID | | Email ID Number of the email to mark as read. | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_NOT\_FOUND
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Move To Folder
``
Moves the email with ID emailId from the sourceFolder to the targetFolder.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Source Folder | | Mailbox folder where the emails to be moved are located. | | |
Target Folder | | Mailbox folder where the emails will be moved. | | |
Email ID | | Email ID Number of the email to move. | | |
Create Target Folder | | Create the target folder if it does not exist. | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
### For Configurations
- [IMAP](#imap)
#### Throws
- EMAIL:EMAIL\_NOT\_FOUND
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### Count messages - POP3
``
Counts the emails in the INBOX\_FOLDER.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Target Variable | | Name of the variable that storesoperation’s output will be placed | | |
Target Value | | An expression to evaluate against the operation’s output and store the expression outcome in the target variable | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
#### Output
### For Configurations
- [POP3](#pop3)
#### Throws
- EMAIL:EMAIL\_COUNT\_MESSAGES
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
### List - POP3
``
List all the emails (with pagination) in the configured pop3 mailBoxFolder that match with the
specified pop3Matcher criteria. As the POP3 protocol does not support the capability to find
specific emails from its UID in a folder to move/delete it. a parameter deleteAfterRetrieve is
available for deleting the emails from the server right after being retrieved.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Mailbox Folder | | Mailbox folder where the emails are going to be fetched | | |
Match with | | Email Matcher which gives the capability of filter the retrieved emails | | |
Delete After Retrieve | | Specifies if the returned emails must be deleted after being retrieved or not. | | |
Page Size | | Size of the page used by the PagingProvider implementation for fetching the emails from the POP3 server | | |
Pagination Offset | | Size of the pagination offset used by the PagingProvider implementation for fetching the emails from the POP3 server | | |
Limit | | Maximum amount of emails retrieved by the operation. Take into account that this limit only applies to the emails effectively retrieved by the operation (the ones which matched the IMAPEmailPredicateBuilder criteria) and doesn’t imply any restriction over the amount of emails being retrieved from the mailbox server. | | |
Streaming Strategy | | Configures how Mule processes streams. Repeatable streams are the default behavior. | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Indicates how attachment names should be retrieved. | | |
Target Variable | | Name of the variable that storesoperation’s output will be placed | | |
Target Value | | An expression to evaluate against the operation’s output and store the expression outcome in the target variable | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
#### Output
### For Configurations
- [POP3](#pop3)
#### Throws
- EMAIL:EMAIL\_LIST
- EMAIL:ACCESSING\_FOLDER
- EMAIL:CONNECTIVITY
### Send
``
Sends an email message. The message is sent to all recipient toAddresses, ccAddresses, bccAddresses
specified in the message. The content of the message aims to be some type of text (text/plan,
text/html) and its composed by the body and it’s content type. If no content is specified then the
incoming payload it’s going to be converted into plain text if possible.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
From Address | | The "From" sender address. The person that is going to send the messages, if not set, it defaults to the from address specified in the config. | | |
To Addresses | | The recipient addresses of "To" (primary) type. | | |
Cc Addresses | | The recipient addresses of "Cc" (carbon copy) type | | |
Bcc Addresses | | The recipient addresses of "Bcc" (blind carbon copy) type | | |
Reply To Addresses | | The email addresses to which this email should be replied. | | |
Subject | | The subject of the email. | | |
Headers | | The headers that this email carry. | | |
Content | | Text body of the message. Aims to be text in any format | | |
ContentType | | ContentType of the body text. Example: "text/plain". | | |
Encoding | | The character encoding of the body. If it is configured, it overrides the one inferred from the body. | | |
Content Transfer Encoding | | Encoding used to indicate the type of transformation that has been used to represent the body in an acceptable manner for transport. The value is case insensitive. Known encodings: * BASE64 * QUOTED-PRINTABLE * 8BIT * 7BIT * BINARY | | |
Attachments | | The attachments for an Email, that is sent along the email body. | | |
Content Transfer Encoding | | Encoding used to indicate the type of transformation that has been used to represent the body in an acceptable manner for transport. The value is case insensitive. Known encodings: * BASE64 * QUOTED-PRINTABLE * 8BIT * 7BIT * BINARY | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
### For Configurations
- [SMTP](#smtp)
#### Throws
- EMAIL:SEND
- EMAIL:CONNECTIVITY
- EMAIL:RETRY\_EXHAUSTED
## Sources
### On New Email - IMAP
``
Retrieves all the emails from an IMAP mailbox folder, watermark can be enabled for polled items.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Folder | | The name of the folder to poll emails from. Defaults to "INBOX". | | |
Delete After Retrieve | | Enables the deletion of the polled emails after being retrieved. This is disabled by default. | | |
Enable Watermark | | If watermark should be applied to the polled emails or not. Default to true. | | |
Imap Matcher | | A matcher to filter emails retrieved by this polling source. For default already read emails will be filtered. | | |
Enable Remote Search | | If search filters should be resolved on server(true) or client(false) side. Default to false because some email servers might not be fully compliant with rfc-3501’s search terms. Activating this feature will diminish traffic by reducing the amount of emails brought to client side for processing. | | |
Primary Node Only | | Determines whether to execute this source on only the primary node when running Mule instances in a cluster. | | |
Scheduling Strategy | | Configures the scheduler that triggers the polling. | | |
Redelivery Policy | | Defines a policy for processing the redelivery of the same message. | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Indicates how attachment names should be retrieved. | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
#### Output
### For Configurations
- [IMAP](#imap)
### On New Email - POP3
``
Retrieves all the emails from an POP3 mailbox folder.
#### Parameters
| Name | Type | Description | Default Value | Required |
|---|
Configuration | | Name of the configuration to use. | | |
Folder | | The name of the folder to poll emails from. Defaults to "INBOX". | | |
Delete After Retrieve | | Enables the deletion of the polled emails after being retrieved. This is disabled by default. | | |
Pop3 Matcher | | A matcher to filter emails retrieved by this polling source. | | |
Primary Node Only | | Determines whether to execute this source on only the primary node when running Mule instances in a cluster. | | |
Scheduling Strategy | | Configures the scheduler that triggers the polling. | | |
Redelivery Policy | | Defines a policy for processing the redelivery of the same message. | | |
Attachment Naming Strategy | NAME NAME_HEADERS NAME_HEADERS_SUBJECT
| Indicates how attachment names should be retrieved. | | |
Reconnection Strategy | | Retry strategy in case of connectivity errors. | | |
#### Output
### For Configurations
- [POP3](#pop3)
## Types
### Reconnection
Configures a reconnection strategy for an operation.
| Field | Type | Description | Default Value | Required |
|---|
Fails Deployment | | When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy. | | |
Reconnection Strategy | | Reconnection strategy to use. | | |
### Reconnect
| Field | Type | Description | Default Value | Required |
|---|
Frequency | | How often to attempt to reconnect, in milliseconds. | | |
Count | | How many reconnection attempts the Mule app can make. | | |
### Reconnect Forever
| Field | Type | Description | Default Value | Required |
|---|
Frequency | | How often to attempt to reconnect, in milliseconds. | | |
### Pooling Profile
| Field | Type | Description | Default Value | Required |
|---|
Max Active | | Controls the maximum number of Mule components that can be borrowed from a session at one time. When set to a negative value, there is no limit to the number of components that may be active at one time. When maxActive is exceeded, the pool is said to be exhausted. | | |
Max Idle | | Controls the maximum number of Mule components that can sit idle in the pool at any time. When set to a negative value, there is no limit to the number of Mule components that may be idle at one time. | | |
Max Wait | | Specifies the number of milliseconds to wait for a pooled component to become available when the pool is exhausted and the exhaustedAction is set to WHEN_EXHAUSTED_WAIT. | | |
Min Eviction Millis | | Determines the minimum amount of time an object may sit idle in the pool before it is eligible for eviction. When non-positive, no objects will be evicted from the pool due to idle time alone. | | |
Eviction Check Interval Millis | | Specifies the number of milliseconds between runs of the object evictor. When non-positive, no object evictor is executed. | | |
Exhausted Action | WHEN_EXHAUSTED_GROW WHEN_EXHAUSTED_WAIT WHEN_EXHAUSTED_FAIL
| Specifies the behavior of the Mule component pool when the pool is exhausted. Possible values are: "WHEN_EXHAUSTED_FAIL", which will throw a NoSuchElementException, "WHEN_EXHAUSTED_WAIT", which will block by invoking Object.wait(long) until a new or idle object is available, or WHEN_EXHAUSTED_GROW, which will create a new Mule instance and return it, essentially making maxActive meaningless. If a positive maxWait value is supplied, it will block for at most that many milliseconds, after which a NoSuchElementException will be thrown. If maxThreadWait is a negative value, it will block indefinitely. | | |
Initialisation Policy | INITIALISE_NONE INITIALISE_ONE INITIALISE_ALL
| Determines how components in a pool should be initialized. The possible values are: INITIALISE_NONE (will not load any components into the pool on startup), INITIALISE_ONE (will load one initial component into the pool on startup), or INITIALISE_ALL (will load all components in the pool on startup) | | |
Disabled | | Whether pooling should be disabled | | |
### TLS
Configures TLS to provide secure communications for the Mule app.
| Field | Type | Description | Default Value | Required |
|---|
Enabled Protocols | | Comma-separated list of protocols enabled for this context. | | |
Enabled Cipher Suites | | Comma-separated list of cipher suites enabled for this context. | | |
Trust Store | | Configures the TLS truststore. | | |
Key Store | | Configures the TLS keystore. | | |
Revocation Check | | | | |
### Truststore
Configures the truststore for TLS.
| Field | Type | Description | Default Value | Required |
|---|
Path | | Path to the truststore. Mule resolves the path relative to the current classpath and file system. | | |
Password | | Password used to protect the truststore. | | |
Type | | | | |
Algorithm | | Encryption algorithm that the truststore uses. | | |
Insecure | | If true, Mule stops performing certificate validations. Setting this to true can make connections vulnerable to attacks. | | |
### Keystore
Configures the keystore for the TLS protocol. The keystore you generate contains a private key and a
public certificate.
| Field | Type | Description | Default Value | Required |
|---|
Path | | Path to the keystore. Mule resolves the path relative to the current classpath and file system. | | |
Type | | | | |
Alias | | Alias of the key to use when the keystore contains multiple private keys. By default, Mule uses the first key in the file. | | |
Key Password | | Password used to protect the private key. | | |
Password | | Password used to protect the keystore. | | |
Algorithm | | Encryption algorithm that the keystore uses. | | |
### Standard Revocation Check
Configures standard revocation checks for TLS certificates.
| Field | Type | Description | Default Value | Required |
|---|
Only End Entities | | Which elements to verify in the certificate chain: Verify only the last element in the certificate chain. Verify all elements in the certificate chain. | | |
Prefer Crls | | How to check certificate validity: Check the Certification Revocation List (CRL) for certificate validity. Use the Online Certificate Status Protocol (OCSP) to check certificate validity. | | |
No Fallback | | Whether to use the secondary method to check certificate validity: Use the method that wasn’t specified in the Prefer Crls field (the secondary method) to check certificate validity. Do not use the secondary method to check certificate validity. | | |
Soft Fail | | What to do if the revocation server can’t be reached or is busy: Avoid verification failure. Allow the verification to fail. | | |
### Custom OCSP Responder
Configures a custom OCSP responder for certification revocation checks.
| Field | Type | Description | Default Value | Required |
|---|
Url | | URL of the OCSP responder. | | |
Cert Alias | | Alias of the signing certificate for the OCSP response. If specified, the alias must be in the truststore. | | |
### CRL File
Specifies the location of the certification revocation list (CRL) file.
| Field | Type | Description | Default Value | Required |
|---|
Path | | | | |
### Expiration Policy
Configures an expiration policy strategy.
| Field | Type | Description | Default Value | Required |
|---|
Max Idle Time | | Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration. | | |
Time Unit | NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS
| Time unit for the Max Idle Time field. | | |
### Stored Email Content
| Field | Type | Description | Default Value | Required |
|---|
Body | | | | |
Attachments | | | | |
### Base Email Attributes
| Field | Type | Description | Default Value | Required |
|---|
Number | | | | |
From Addresses | | | | |
To Addresses | | | | |
Cc Addresses | | | | |
Bcc Addresses | | | | |
Reply To Addresses | | | | |
Headers | | Map of HTTP headers in the message. | | |
Subject | | | | |
Received Date | | | | |
Sent Date | | | | |
### Imap Matcher
| Field | Type | Description | Default Value | Required |
|---|
Seen | | Indicates if should retrieve 'seen' or 'not seen' emails | | |
Answered | | Indicates if should retrieve 'answered' or 'not answered' emails | | |
Deleted | | Indicates if should retrieve 'marked as deleted' or 'not marked as deleted' emails | | |
Recent | | "Indicates if should retrieve 'recent' or 'not recent' emails | | |
Received Since | | Indicates since which date the received emails must be retrieved | | |
Received Until | | Indicates until which date the received emails must be retrieved | | |
Sent Since | | Indicates since which date the sent emails must be retrieved | | |
Sent Until | | Indicates until which date the sent emails must be retrieved | | |
Subject Regex | | Subject Regex to match with the wanted emails | | |
From Regex | | From Email Address Regex to match with the wanted emails | | |
### Redelivery Policy
Configures the redelivery policy for executing requests that generate errors. You can add a
redelivery policy to any source in a flow.
| Field | Type | Description | Default Value | Required |
|---|
Max Redelivery Count | | Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error. | | |
Use Secure Hash | | If true, Mule uses a secure hash algorithm to identify a redelivered message. | | |
Message Digest Algorithm | | Secure hashing algorithm to use if the Use Secure Hash field is true. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s hashCode() returned. | | |
Id Expression | | One or more expressions that determine when a message was redelivered. You can set this property only if the Use Secure Hash field is false. | | |
Object Store | | Configures the object store that stores the redelivery counter for each message. | | |
### IMAP Email Attributes
| Field | Type | Description | Default Value | Required |
|---|
Flags | | | | |
Id | | | | |
Number | | | | |
From Addresses | | | | |
To Addresses | | | | |
Cc Addresses | | | | |
Bcc Addresses | | | | |
Reply To Addresses | | | | |
Headers | | Map of HTTP headers in the message. | | |
Subject | | | | |
Received Date | | | | |
Sent Date | | | | |
### Email Flags
| Field | Type | Description | Default Value | Required |
|---|
Answered | | | | |
Deleted | | | | |
Draft | | | | |
Recent | | | | |
Seen | | | | |
### Repeatable In Memory Iterable
| Field | Type | Description | Default Value | Required |
|---|
Initial Buffer Size | | The amount of instances that is initially be allowed to be kept in memory to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the bufferSizeIncrement attribute, with an upper limit of maxInMemorySize. Default value is 100 instances. | | |
Buffer Size Increment | | This is by how much the buffer size expands if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full. Default value is 100 instances. | | |
Max Buffer Size | | Maximum size of the buffer. If the buffer size exceeds this value, Mule raises a STREAM_MAXIMUM_SIZE_EXCEEDED error. A value of less than or equal to 0 means no limit. | | |
### Repeatable File Store Iterable
| Field | Type | Description | Default Value | Required |
|---|
In Memory Objects | | The maximum amount of instances to keep in memory. If more than that is required, content on the disk is buffered. | | |
Buffer Unit | | Unit for the In Memory Size field. | | |
### Pop3 Matcher
| Field | Type | Description | Default Value | Required |
|---|
Received Since | | Indicates since which date the received emails must be retrieved | | |
Received Until | | Indicates until which date the received emails must be retrieved | | |
Sent Since | | Indicates since which date the sent emails must be retrieved | | |
Sent Until | | Indicates until which date the sent emails must be retrieved | | |
Subject Regex | | Subject Regex to match with the wanted emails | | |
From Regex | | From Email Address Regex to match with the wanted emails | | |
### POP3 Email Attributes
| Field | Type | Description | Default Value | Required |
|---|
Id | | | | |
Number | | | | |
From Addresses | | | | |
To Addresses | | | | |
Cc Addresses | | | | |
Bcc Addresses | | | | |
Reply To Addresses | | | | |
Headers | | Map of HTTP headers in the message. | | |
Subject | | | | |
Received Date | | | | |
Sent Date | | | | |
---
product: Email Connector
version: 1.7
---
# Email Connector XML and Maven Support
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio.
If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML
editor or from a text editor, you can get access to the connector in your app by adding reference
statements to both your XML Mule flow and the Apache Maven `pom.xml` file.
When you add the connector in Studio, Studio automatically populates the XML code with the
connector’s namespace and schema location. It also adds a dependency to the `pom.xml` file.
## Add a Namespace for the Connector
Paste the following code inside the `` tag of the header of your configuration XML:
```xml
http://www.mulesoft.org/schema/mule/email>
http://www.mulesoft.org/schema/mule/email/current/mule-email.xsd
```
This example shows how the namespace statements are placed in the `` XML block:
```xml
```
## Add a POM File Dependency
The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app.
If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to
this connector:
```xml
org.mule.connectors
mule-email-connector
x.x.x
mule-plugin
```
Replace `x.x.x` with the version that corresponds to the connector you are using.
To obtain the most up-to-date `pom.xml` file information:
1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/).
2. In Exchange, click **Login** and supply your Anypoint Platform username and password.
3. In Exchange, search for `email`.
4. Select the connector.
5. Click **Dependency Snippets** near the upper right of the screen.
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# Email Connector XML and Maven Support
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio.
If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML
editor or from a text editor, you can get access to the connector in your app by adding reference
statements to both your XML Mule flow and the Apache Maven `pom.xml` file.
When you add the connector in Studio, Studio automatically populates the XML code with the
connector’s namespace and schema location. It also adds a dependency to the `pom.xml` file.
## Add a Namespace for the Connector
Paste the following code inside the `` tag of the header of your configuration XML:
```xml
http://www.mulesoft.org/schema/mule/email>
http://www.mulesoft.org/schema/mule/email/current/mule-email.xsd
```
This example shows how the namespace statements are placed in the `` XML block:
```xml
```
## Add a POM File Dependency
The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app.
If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to
this connector:
```xml
org.mule.connectors
mule-email-connector
x.x.x
mule-plugin
```
Replace `x.x.x` with the version that corresponds to the connector you are using.
To obtain the most up-to-date `pom.xml` file information:
1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/).
2. In Exchange, click **Login** and supply your Anypoint Platform username and password.
3. In Exchange, search for `email`.
4. Select the connector.
5. Click **Dependency Snippets** near the upper right of the screen.
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
---
# List Emails with Email Connector Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Anypoint Connector for Email (Email Connector) provides the **List - IMAP** and **List - POP3**
operations, which list emails from any part of the flow. The following examples illustrate how to
configure these operations for the connector:
- [List Emails from an IMAPS Server](#list-emails-from-an-imaps-server)
Configure the **List - IMAP** operation to list all the emails in the configured IMAP mailbox
folder from an IMAPS server that has a TLS connection. Additionally, set a **For Each** scope
component and two **Set Variable** components to iterate over the emails and save the email body
and attachment content in variables.
- [List Emails from a POP3 Server](#list-emails-from-a-pop3-server)
Configure the **List - POP3** operation to list all the emails in the configured POP3 mailbox
folder that matched the criteria specified in the **Match with** parameter.
These example use variables for some field values. You can either:
- Replace the variables with their values in the code.
- Provide the values for each variable in a properties file and then refer to that file from the
connector configuration.
If you don’t know how to use a properties file, see
[Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure).
## List Emails from an IMAPS Server
The following example illustrates how to list all the emails in the configured IMAP mailbox folder
from an IMAPS server that has a TLS connection. A **Scheduler** component initiates the flow, and
then the **List - IMAP** operation lists the emails. Subsequently, a **For Each** scope component
and two **Set Variable** components iterate over the emails, and save the body and attachments of
the email content payload in variables:
The following screenshot shows the app flow for this example:

Figure 1. List Emails from an IMAPS Server flow
To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
This source initiates a flow when a time-based condition is met.
3. Drag the **List - IMAP** operation to the right of the **Scheduler** source.
4. On the **List - IMAP** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
5. For **Connection**, select **IMAPS Connection**.
6. In the **General** tab, enter the following values:
- **Host** `imap.gmail.com`
- **Port** `993`
- **User** `user1@domain.com`
- **Password** `passwordconnection`
7. In the **TLS Configuration** section, select **Edit inline**.
8. In the **Trust Store Configuration** section, enter the following values:
- **Path** `aTruststore.jks`
- **Password** `passwordtrust`
9. In the **Key Store Configuration** section, enter the following values:
- **Path** `aKeystore`
- **Password** `passwordkey`
10. In the **Advanced** section, set **Enabled Protocols** to `TLSv1.2,SSLv3`.
11. Click **OK**.

12. On the **List - IMAP** configuration screen, set the **Mailbox folder** field to `INBOX`.

13. Drag the **For each** scope component to the right of the **List - IMAP** operation.
14. Drag a **Set Variable** component inside the **For each** scope component.
15. Set **Name** to `email-content` and **Value** to `payload.body`.
This component saves the body content of the email in a new variable.
16. Drag another **Set Variable** component to the right of the first **Set Variable** component.
17. Set **Name** to `json-attachment` and **Value** to `#[payload.attachments.'attachment-name']`.
This component saves the email `.json` attachment to a new variable.
18. Save and run the app.
### XML for Listing Emails from an IMAPS Server
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
```
## Set Pagination Offset for List IMAP
The **Pagination offset** field enables you to set the pagination offset and retrieve a certain
record (or subset of records) within a particular page for the **List - IMAP** operation.
1. In Studio, select the **List - IMAP** operation from your flow.
2. Set **Connector configuration** to **Email\_IMAP\_outlook**.
3. Set **Page size** to `10`.
4. Set **Pagination offset** to `2`.

In the **Configuration XML** editor, the `paginationOffset` configuration looks like this:
```xml
```
## List Emails from a POP3 Server
When listing emails, you can filter them using the **Match with** parameter, which defines the
criteria to process the emails. All matcher attributes are optional. They are also related to each
other under an `AND` operator, meaning that all the criteria must be true. These attributes vary
depending on the type of configuration that you are using. For example, the IMAP protocol provides
more metadata about the retrieved email such as the `recent`, `seen`, `deleted`, and `answered`
attribute flags.
The following example illustrates how to list all the emails in the configured POP3 mailbox folder
that match the specified criteria set in the **Match with** parameter for the configuration. A
**Scheduler** component initiates the flow, and then the **List - POP3** operation lists only the
emails whose subject regex match `BETA`:
The following screenshot shows the app flow for this example:

Figure 2. List Emails from an POP3 Server flow
To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
This source initiates a flow when a time-based condition is met.
3. Drag the **List - POP3** operation to the right of the **Scheduler** source.
4. On the **List - POP3** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
5. For **Connection**, select **POP3 Connection**.
6. In the **General** tab, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user2@domain.com`
- **Password** `passwordconnection`
7. Click **OK**.

8. On the **List - POP3** configuration screen, set the **Mailbox folder** field to `INBOX`.
9. Set **Match with** to `Edit inline`
10. Set **Subject regex** to `BETA.`

11. Save and run the app.
### XML for Listing Emails from a POP3 server
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
```
## Set Pagination Offset for List POP3
The **Pagination offset** field enables you to set the pagination offset and retrieve a certain
record (or subset of records) within a particular page for the **List - POP3** operation.
1. In Studio, select the **List - POP3** operation from your flow.
2. Set **Connector configuration** to **Email\_POP3**.
3. Set **Page size** to `10`.
4. Set **Pagination offset** to `2`.

In the **Configuration XML** editor, the `paginationOffset` configuration looks like this:
```xml
```
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/1.7/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# List Emails with Email Connector Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Anypoint Connector for Email (Email Connector) provides the **List - IMAP** and **List - POP3**
operations, which list emails from any part of the flow. The following examples illustrate how to
configure these operations for the connector:
- [List Emails from an IMAPS Server](#list-emails-from-an-imaps-server)
Configure the **List - IMAP** operation to list all the emails in the configured IMAP mailbox
folder from an IMAPS server that has a TLS connection. Additionally, set a **For Each** scope
component and two **Set Variable** components to iterate over the emails and save the email body
and attachment content in variables.
- [List Emails from a POP3 Server](#list-emails-from-a-pop3-server)
Configure the **List - POP3** operation to list all the emails in the configured POP3 mailbox
folder that matched the criteria specified in the **Match with** parameter.
These example use variables for some field values. You can either:
- Replace the variables with their values in the code.
- Provide the values for each variable in a properties file and then refer to that file from the
connector configuration.
If you don’t know how to use a properties file, see
[Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure).
## List Emails from an IMAPS Server
The following example illustrates how to list all the emails in the configured IMAP mailbox folder
from an IMAPS server that has a TLS connection. A **Scheduler** component initiates the flow, and
then the **List - IMAP** operation lists the emails. Subsequently, a **For Each** scope component
and two **Set Variable** components iterate over the emails, and save the body and attachments of
the email content payload in variables:
The following screenshot shows the app flow for this example:

Figure 1. List Emails from an IMAPS Server flow
To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
This source initiates a flow when a time-based condition is met.
3. Drag the **List - IMAP** operation to the right of the **Scheduler** source.
4. On the **List - IMAP** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
5. For **Connection**, select **IMAPS Connection**.
6. In the **General** tab, enter the following values:
- **Host** `imap.gmail.com`
- **Port** `993`
- **User** `user1@domain.com`
- **Password** `passwordconnection`
7. In the **TLS Configuration** section, select **Edit inline**.
8. In the **Trust Store Configuration** section, enter the following values:
- **Path** `aTruststore.jks`
- **Password** `passwordtrust`
9. In the **Key Store Configuration** section, enter the following values:
- **Path** `aKeystore`
- **Password** `passwordkey`
10. In the **Advanced** section, set **Enabled Protocols** to `TLSv1.2,SSLv3`.
11. Click **OK**.

12. On the **List - IMAP** configuration screen, set the **Mailbox folder** field to `INBOX`.

13. Drag the **For each** scope component to the right of the **List - IMAP** operation.
14. Drag a **Set Variable** component inside the **For each** scope component.
15. Set **Name** to `email-content` and **Value** to `payload.body`.
This component saves the body content of the email in a new variable.
16. Drag another **Set Variable** component to the right of the first **Set Variable** component.
17. Set **Name** to `json-attachment` and **Value** to `#[payload.attachments.'attachment-name']`.
This component saves the email `.json` attachment to a new variable.
18. Save and run the app.
### XML for Listing Emails from an IMAPS Server
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
```
## Set Pagination Offset for List IMAP
The **Pagination offset** field enables you to set the pagination offset and retrieve a certain
record (or subset of records) within a particular page for the **List - IMAP** operation.
1. In Studio, select the **List - IMAP** operation from your flow.
2. Set **Connector configuration** to **Email\_IMAP\_outlook**.
3. Set **Page size** to `10`.
4. Set **Pagination offset** to `2`.

In the **Configuration XML** editor, the `paginationOffset` configuration looks like this:
```xml
```
## List Emails from a POP3 Server
When listing emails, you can filter them using the **Match with** parameter, which defines the
criteria to process the emails. All matcher attributes are optional. They are also related to each
other under an `AND` operator, meaning that all the criteria must be true. These attributes vary
depending on the type of configuration that you are using. For example, the IMAP protocol provides
more metadata about the retrieved email such as the `recent`, `seen`, `deleted`, and `answered`
attribute flags.
The following example illustrates how to list all the emails in the configured POP3 mailbox folder
that match the specified criteria set in the **Match with** parameter for the configuration. A
**Scheduler** component initiates the flow, and then the **List - POP3** operation lists only the
emails whose subject regex match `BETA`:
The following screenshot shows the app flow for this example:

Figure 2. List Emails from an POP3 Server flow
To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
This source initiates a flow when a time-based condition is met.
3. Drag the **List - POP3** operation to the right of the **Scheduler** source.
4. On the **List - POP3** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
5. For **Connection**, select **POP3 Connection**.
6. In the **General** tab, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user2@domain.com`
- **Password** `passwordconnection`
7. Click **OK**.

8. On the **List - POP3** configuration screen, set the **Mailbox folder** field to `INBOX`.
9. Set **Match with** to `Edit inline`
10. Set **Subject regex** to `BETA.`

11. Save and run the app.
### XML for Listing Emails from a POP3 server
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
```
## Set Pagination Offset for List POP3
The **Pagination offset** field enables you to set the pagination offset and retrieve a certain
record (or subset of records) within a particular page for the **List - POP3** operation.
1. In Studio, select the **List - POP3** operation from your flow.
2. Set **Connector configuration** to **Email\_POP3**.
3. Set **Page size** to `10`.
4. Set **Pagination offset** to `2`.

In the **Configuration XML** editor, the `paginationOffset` configuration looks like this:
```xml
```
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/latest/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
---
# Move Messages Between Folders for IMAP/S Connection Providers Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Anypoint Connector for Email (Email Connector) provides the **Move to folder** operation that
enables you to move messages to folders for IMAP and IMAPS connection providers. The operation’s
main features include:
- Moving messages between folders of the email server.
- Preserving the moved message UID.
- Creating the target folder if the folder does not exist or fails depending on a parameter.
The following examples illustrate how to configure the operation for the connector.
## Move a Message from One Folder to Another Folder
The following example illustrates how to move a received message from one folder to another folder.
An **On New Email - IMAP** source initiates the flow, and then the **Mark as read** operation reads
the received email in the `INBOX` folder. Subsequently, the **Move to folder** operation moves the
email to the `TARGET` folder:
The following screenshot shows the app flow for this example:

To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, drag the **On New Email - IMAP** operation onto the canvas.
3. On the **On New Email - IMAP** configuration screen, click the plus sign (**+**) next to the
**Connector configuration** field to configure a global element for the operation.
4. Set **Connection** to **IMAPS Connection**.
5. Complete the following fields:
- **Host**: `test.host.com`
- **Port**: `993`
- **User**: `test123@testuser.com`
- **Password**: `testpassword`
6. Click **OK**.
7. Set **Folder** to `INBOX`.
8. Drag a **Mark as read** operation to the right of the **On New Email - IMAP** source.
9. For **Connector configuration**, select the previously created global configuration.
10. Set **Mailbox folder** to `INBOX`.
11. Set **Email ID** to the expression `attributes.id`.
12. Drag a **Move to folder** operation to the right of the **Mark as read** operation.
13. For **Connector configuration**, select the previously created global configuration.
14. Set **Mailbox folder** to `INBOX`.
15. Set **Target folder** to `TEST`.
16. Set **Email ID** to the expression `attributes.id`.
17. Save and run your Mule application.
18. Send a new email to the email address.
### XML for Moving a Message from One Folder to Another Folder
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
```
## Move a Message to a Target Folder and Create the Folder When Is Non-existent
The following example illustrates how to move a received message from one folder to another, if the
target folder does not exist, the folder is then created. An **On New Email - IMAP** source
initiates the flow, and then the **Mark as read** operation reads the received email in the `INBOX`
folder. Subsequently, the **Move to folder** operation moves the email to the `TARGET` folder. If
that folder does not exist, it is created automatically.
The following screenshot shows the app flow for this example:

To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, drag the **On New Email - IMAP** operation onto the canvas.
3. On the **On New Email - IMAP** configuration screen, click the plus sign (**+**) next to the
**Connector configuration** field to configure a global element for the operation.
4. Set **Connection** to **IMAPS Connection**.
5. Complete the following fields:
- **Host**: `test.host.com`
- **Port**: `993`
- **User**: `test123@testuser.com`
- **Password**: `testpassword`
6. Click **OK**.
7. Set **Folder** to **INBOX**.
8. Drag a **Mark as read** operation to the right of the **On New Email - IMAP** source.
9. For **Connector configuration**, select the previously created global configuration.
10. Set **Mailbox folder** to `INBOX`.
11. Set **Email ID** to the expression `attributes.id`.
12. Drag a **Move to folder** operation to the right of the **Mark as read** operation.
13. For **Connector configuration**, select the previously created global configuration.
14. Set **Mailbox folder** to `INBOX`.
15. Set **Target folder** to `TEST_B`.
16. Set **Email ID** to the expression `attributes.id`.
17. Set **Create target folder** to **TRUE**.

18. Save and run your Mule application.
19. Send a new email to the email address.
### XML for Moving a Message to a Target Folder and Create the Folder When Is Non-existent
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
```
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/1.7/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# Move Messages Between Folders for IMAP/S Connection Providers Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Anypoint Connector for Email (Email Connector) provides the **Move to folder** operation that
enables you to move messages to folders for IMAP and IMAPS connection providers. The operation’s
main features include:
- Moving messages between folders of the email server.
- Preserving the moved message UID.
- Creating the target folder if the folder does not exist or fails depending on a parameter.
The following examples illustrate how to configure the operation for the connector.
## Move a Message from One Folder to Another Folder
The following example illustrates how to move a received message from one folder to another folder.
An **On New Email - IMAP** source initiates the flow, and then the **Mark as read** operation reads
the received email in the `INBOX` folder. Subsequently, the **Move to folder** operation moves the
email to the `TARGET` folder:
The following screenshot shows the app flow for this example:

To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, drag the **On New Email - IMAP** operation onto the canvas.
3. On the **On New Email - IMAP** configuration screen, click the plus sign (**+**) next to the
**Connector configuration** field to configure a global element for the operation.
4. Set **Connection** to **IMAPS Connection**.
5. Complete the following fields:
- **Host**: `test.host.com`
- **Port**: `993`
- **User**: `test123@testuser.com`
- **Password**: `testpassword`
6. Click **OK**.
7. Set **Folder** to `INBOX`.
8. Drag a **Mark as read** operation to the right of the **On New Email - IMAP** source.
9. For **Connector configuration**, select the previously created global configuration.
10. Set **Mailbox folder** to `INBOX`.
11. Set **Email ID** to the expression `attributes.id`.
12. Drag a **Move to folder** operation to the right of the **Mark as read** operation.
13. For **Connector configuration**, select the previously created global configuration.
14. Set **Mailbox folder** to `INBOX`.
15. Set **Target folder** to `TEST`.
16. Set **Email ID** to the expression `attributes.id`.
17. Save and run your Mule application.
18. Send a new email to the email address.
### XML for Moving a Message from One Folder to Another Folder
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
```
## Move a Message to a Target Folder and Create the Folder When Is Non-existent
The following example illustrates how to move a received message from one folder to another, if the
target folder does not exist, the folder is then created. An **On New Email - IMAP** source
initiates the flow, and then the **Mark as read** operation reads the received email in the `INBOX`
folder. Subsequently, the **Move to folder** operation moves the email to the `TARGET` folder. If
that folder does not exist, it is created automatically.
The following screenshot shows the app flow for this example:

To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, drag the **On New Email - IMAP** operation onto the canvas.
3. On the **On New Email - IMAP** configuration screen, click the plus sign (**+**) next to the
**Connector configuration** field to configure a global element for the operation.
4. Set **Connection** to **IMAPS Connection**.
5. Complete the following fields:
- **Host**: `test.host.com`
- **Port**: `993`
- **User**: `test123@testuser.com`
- **Password**: `testpassword`
6. Click **OK**.
7. Set **Folder** to **INBOX**.
8. Drag a **Mark as read** operation to the right of the **On New Email - IMAP** source.
9. For **Connector configuration**, select the previously created global configuration.
10. Set **Mailbox folder** to `INBOX`.
11. Set **Email ID** to the expression `attributes.id`.
12. Drag a **Move to folder** operation to the right of the **Mark as read** operation.
13. For **Connector configuration**, select the previously created global configuration.
14. Set **Mailbox folder** to `INBOX`.
15. Set **Target folder** to `TEST_B`.
16. Set **Email ID** to the expression `attributes.id`.
17. Set **Create target folder** to **TRUE**.

18. Save and run your Mule application.
19. Send a new email to the email address.
### XML for Moving a Message to a Target Folder and Create the Folder When Is Non-existent
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
```
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/latest/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
keywords: email, connector, configuration, smtp, send, smtps
---
# Send Emails with Email Connector Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Use Anypoint Connector for Email (Email Connector) to send messages over SMTP and SMTPS servers by
using the **Send** operation. The following examples show how to configure Email Connector to send
emails and attachments, in both Anypoint Studio and the XML editor:
- [Send Emails](#send-email)
Configure the Email Connector **Send** operation to send emails over an SMTPS server.
- [Send an Attachment](#send-attachments)
Configure the File Connector **Read** operation to read a JSON file and the Email Connector
**Send** operation to send the file as an attachment over an SMTP server.
- [Send Multiple Attachments](#send-multiple-attachments)
Configure **Set Variable** components to define multiple media type attachments, and send these
attachments using the Email Connector **Send** operation. Then log the result message using a
**Logger** component.
## Send Emails
The following example illustrates how to send emails over the SMTPS server. The flow initiates with
a **Scheduler** component, and then the **Send** operation sends the email. The SMTPS connection
type enables SSL or TLS encryption and sends encrypted messages over the secured version of the SMTP
server.
The following screenshot shows the app flow for this example:

To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
This source initiates a flow when a time-based condition is met.
3. Drag the Email **Send** operation to the right of the **Scheduler** source.
4. On the **Send** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
5. For **Connection**, select **SMTPS Connection**.
6. In the **General** tab, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user3@domain.com`
- **Password** `passwordconnection`
7. In the **TLS Configuration** section, select **Edit inline**.
8. In the **Trust Store Configuration** section, complete these fields:
- **Path** `trustore path`
- **Password** `passwordtrust`
9. In the **Key Store Configuration** section, enter the following values:
- **Path** `aKeystore`
- **Password** `passwordkey`
10. In the **Advanced** section, set **Enabled Protocols** to `TLSv1.2,SSLv3`.
11. Click **OK**.

12. In the **Send** operation configuration screen, set the following values:
- **From address** `user1@domain.com`
- **To addresses** `Edit inline`
13. Click the plus sign (**+**) to add new emails.
14. Set **Value** to `user2@domain.com`.
15. Repeat the previous two actions and add another email as `user3@domain.com`.
16. Set **Subject** to `IMPORTANT!`.
17. Set **Content** to `"Hello this is an important message
"` and **ContentType** to
`text/html`.
If **Content** is not empty, the content of the message payload is used by default. If that
payload is not `text`, the operation fails with an `EMAIL:SEND` error.
18. Save and run the app.

### XML for Sending Emails
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
Hello this is an important message"]]>
```
## Send an Attachment
The following example illustrates how to send emails and attachments over the SMTP server. Use
DataWeave to manage the attachments. The flow reads a JSON file using the File Connector **Read**
operation and then uses the Email Connector **Send** operation to send the content of the file as an
attachment:
The following screenshot shows the Anypoint Studio app flow for this example:

To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
The source initiates a flow when a time-based condition is met.
3. Drag the File Connector **Read** operation to the right of the **Scheduler** component.
4. Set **File Path** to `file.json`.
5. Drag the **Send** operation to the right of the **Read** operation.
6. On the **Send** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
7. For **Connection**, select **SMTP Connection**.
8. In the **General** tab, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user1@domain.com`
- **Password** `password`
9. Click **OK**.
10. In the **Send** operation configuration screen, set the **To addresses** field to `Edit inline`.
11. Click the plus sign (**+**) to add a new email **Value** as `example@domain.com`.
12. Set **Subject** to `Attachment test`.
13. Set **Content** to `"Hello this is an important message
"`.
14. In the **Attachments** field, enter the following DataWeave expression as a new attachment
element:
```DataWeave
{
'json-attachment' : payload
}
```
Note that `payload` is the content of the JSON file read by the File Connector **Read**
operation.
15. Save and run the app.

### XML for Sending Attachments
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
Hello this is an important message"]]]>
#[{
'json-attachment' : "payload"
}]
```
## Send Multiple Attachments
The following example illustrates how to send emails and multiple attachments over the SMTP server.
The flow initiates with a **Scheduler** component. Then, **Set Variable** components define each
attachment media type JSON, text and file. Subsequently, the Email Connector **Send** operation
sends the attachments in the email, after which you the result message using a **Logger** component.
The following screenshot shows the Anypoint Studio app flow for this example:

Figure 1. Email Connector Multiple attachments
To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
The source initiates a flow when a time-based condition is met and sends the emails.
3. Drag a **Set Variable** component to the right of the **Scheduler** component.
4. In the **Set Variable** configuration screen, set the following parameters:
- **Name** `json`
- **Value** `output application/json --- {address: '221B Baker Street'}`
- **MIME Type** `application/json`
5. Drag another **Set Variable** component to the right of the first **Set Variable** component,
and set the following parameters:
- **Name** `textPlain`
- **Value** `This is the email text attachment for John Watson`
- **MIME Type** `text/plain`
6. Drag another **Set Variable** component to the right of the second **Set Variable** component,
and set the following parameters:
- **Name** `octectStream`
- **Value** `vars.textPlain`
- **MIME Type** `application/octet-stream`
7. Drag the Email **Send** operation to the right of the third **Set Variable** component.
8. On the **Send** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
9. For **Connection**, select **SMTP Connection**.
10. In the **General** tab, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user1@domain.com`
- **Password** `password`
11. Click **OK**.
12. In the **Send** operation configuration screen, set the **To addresses** field to `Edit inline`
13. Click the plus sign (**+**) to add a new email **Value** as `user4@domain.com`.
14. Set the **Content** field to `Email Content` and the **ContentType** field to `text/plain`.
15. In the **Attachments** field, enter the following DataWeave expression:
```DataWeave
{
'text-attachment' : vars.textPlain,
'json-attachment' : vars.json,
'stream-attachment' : vars.octetStream
}
```
16. Save and run the app.

### XML for Sending Multiple Attachments
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
Email Content
#[{
'text-attachment' : vars.textPlain,
'json-attachment' : vars.json,
'stream-attachment' : vars.octetStream
}]
```
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/1.7/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
keywords: email, connector, configuration, smtp, send, smtps
---
# Send Emails with Email Connector Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Use Anypoint Connector for Email (Email Connector) to send messages over SMTP and SMTPS servers by
using the **Send** operation. These examples show how to configure Email Connector to send emails
and attachments.
- [Understanding Attachments and the Attachments Map](#understanding-attachments)
Understand when to use fixed or dynamic attachments, what the **Attachments** parameter expects
(DataWeave expression returning a map), and how content types work.
- [Send Emails](#send-email)
Configure the Email Connector **Send** operation to send emails over an SMTPS server.
- [Configure TLS: Truststore and Keystore](#truststore-keystore)
Configure truststore and keystore files for SMTPS
- [Send an Attachment](#send-attachments)
Configure the File Connector **Read** operation to read a JSON file and the Email Connector
**Send** operation to send the file as an attachment over an SMTP server.
- [Send Multiple Attachments](#send-multiple-attachments)
Configure **Set Variable** components to define multiple media type attachments, and send these
attachments using the Email Connector **Send** operation. Then log the result message using a
**Logger** component.
- [Send Attachments Received from a REST API](#send-attachments-from-api)
Accept a PDF, MS Word document, and JSON file (for example, an incident report) via multipart REST
API, and forward them to a support function by email.
- [Send Files from an SFTP Server by Email](#send-sftp-files-by-email)
Poll or list files on an SFTP server and send them as email attachments to a function or mailbox.
## Understand Attachments
This section explains when to use fixed vs dynamic attachments, and what the **Attachments**
parameter expects.
### Using Fixed vs Dynamic Attachments
- Fixed attachments
These are useful when the same file is always sent with certain emails, for example:
- A legal disclaimer or terms document (PDF) attached to every outgoing contract email
- A cover letter or template (for example, a Word or PDF) that is the same for a batch of
notifications
- A static report template or form that recipients always need
In these cases you typically read the file once (for example, from classpath or a fixed path) or
set it in a variable, then reference it in the **Attachments** map.
- Dynamic attachments
These are built from runtime data: payload from a flow (File read, HTTP multipart, SFTP read),
variables set earlier in the flow, or DataWeave expressions that produce binary or string content.
The examples in this page show both patterns.
### Understanding Attachments Expectations
The **Attachments** parameter of the **Send** operation expects a DataWeave expression that
evaluates to an object (a map). It isn’t a Java type nor raw JSON configured in the UI; you write a
DataWeave expression (for example, in the XML `email:attachments` element or in the Studio
**Attachments** field) that produces the map.
- Map structure: Each key is the **attachment filename** (as shown in the email client). Each value
is the attachment content (Binary, String, or a stream).
- Content type: The map itself does not have a single content type. Each value is the raw content;
the connector uses the content as-is. When the value comes from a Mule message (for example,
`payload` or `vars.x`) that has a MIME type (for example, from an HTTP multipart part or a File
read), that type is used for the attachment. For inline DataWeave content, you can control the
type by using `read()` with a MIME type or by ensuring the value is the correct type (for example,
`output application/octet-stream` for binary).
- Example: `{ 'report.pdf' : payload }` uses the current payload as the content of `report.pdf`; if
`payload` was read from a file or HTTP part, its existing MIME type is used.
### Understanding Binary Attachments
Files such as Portable Document Format (PDF), Portable Network Graphics (PNG), Word documents, or
any non-text binary must be sent as binary content in the attachments map. SMTP transports text;
binary data is encoded for transport (for example, Base64).
- Pass the file content as binary. Do not convert binary data to String (for example, don’t use a
string representation or a character encoding like UTF-8 for the bytes); that can corrupt the
file. When you use the File Connector **Read** operation, HTTP **Listener** multipart parts, or
SFTP **Read**, the payload (or part content) is already binary and has the appropriate MIME type
(for example, `application/pdf`, `image/png`). Use that value directly in the attachments map.
- Email Connector encodes non-text attachments for transport. The default is **Base64**, which is
appropriate for PDF, PNG, and other binary formats. You don’t need to Base64-encode the value
yourself; the connector applies the encoding. To use a different encoding (for example,
QUOTED-PRINTABLE, 8BIT, 7BIT, or BINARY), configure the **Content Transfer Encoding** parameter on
the **Send** operation.
- If you build the attachment from a path or classpath resource, use DataWeave `read()` with the
correct MIME type so the value stays Binary and the attachment is sent with the right type. For
example:
```dataweave
{
'disclaimer.pdf' : read('classpath://disclaimer.pdf', 'application/pdf'),
'logo.png' : read('classpath://logo.png', 'image/png')
}
```
This keeps the content as binary and sets the MIME type for each attachment. The connector then
applies Content-Transfer-Encoding (default Base64) when sending.
## Send Emails
This example illustrates how to send emails over the SMTPS server. The flow initiates with a
**Scheduler** component, and then the **Send** operation sends the email. The SMTPS connection type
enables SSL or TLS encryption and sends encrypted messages over the secured version of the SMTP
server.
This screenshot shows the app flow for this example:

To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
This source initiates a flow when a time-based condition is met.
3. Drag the Email **Send** operation to the right of the **Scheduler** source.
4. On the **Send** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
5. For **Connection**, select **SMTPS Connection**.
6. In the **General** tab, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user3@domain.com`
- **Password** `passwordconnection`
7. In the **TLS Configuration** section, select **Edit inline**.
8. In the **Trust Store Configuration** section, complete these fields:
- **Path** `truststore path`
- **Password** `passwordtrust`
9. In the **Key Store Configuration** section, enter the following values:
- **Path** `aKeystore`
- **Password** `passwordkey`
10. In the **Advanced** section, set **Enabled Protocols** to `TLSv1.2,SSLv3`.
11. Click **OK**.

12. In the **Send** operation configuration screen, set the following values:
- **From address** `user1@domain.com`
- **To addresses** `Edit inline`
13. Click the plus sign (**+**) to add new emails.
14. Set **Value** to `user2@domain.com`.
15. Repeat the previous two actions and add another email as `user3@domain.com`.
16. Set **Subject** to `IMPORTANT!`.
17. Set **Content** to `"Hello this is an important message
"` and **ContentType** to
`text/html`.
If **Content** is not empty, the content of the message payload is used by default. If that
payload is not `text`, the operation fails with an `EMAIL:SEND` error.
18. Save and run the app.

### XML for Sending Emails
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
Hello this is an important message"]]>
```
## Configuring TLS: Truststore and Keystore
When you use SMTPS Connection, you must configure Transport Layer Security (TLS) encryption. The
**Trust Store** and optionally **Key Store** settings tell the connector which certificates to use.
### Locating the Path
The **Path** in **Trust Store** and **Key Store** setting is resolved relative to (in order):
- The current classpath (for example, files under `src/main/resources` in your project)
- The file system (relative to the app runtime or absolute path)
Typical locations:
- Project resource: `src/main/resources/truststore.jks` — use path `truststore.jks` or
`classpath:truststore.jks`
- Absolute path: `/etc/mule/truststore.jks` (ensure the runtime has read access)
### Configuring Trust Store
The **Trust Store** holds certificates of servers (or CAs) that your app trusts. For SMTPS, the
client uses it to verify the mail server’s certificate.
For SMTPS you almost always need a truststore so the connector can validate the server’s certificate
(unless you use **Insecure** for development only).
- If your server uses a public CA (for example Gmail, Office 365): You can use the JVM’s default
truststore (often not required to set one) or export it and point **Path** to that file. Some
setups use a custom truststore that contains only the CA or server cert they need.
- Creating or updating a truststore with keytool (Java’s `keytool` is usually under
`JAVA_HOME/bin`):
- Import a CA or server certificate into a new truststore:
```bash
keytool -importcert -alias smtpserver -file server.cer -keystore truststore.jks -storepass changeit -noprompt
```
- Replace `server.cer` with the path to the server’s certificate or the CA certificate, and
`truststore.jks` with the path where you want the truststore file. Use a strong password in
production instead of `changeit`.
- In the Email Connector TLS configuration, set **Path** to the path of this trust store and
**Password** to the truststore password.
### Configuring Keystore
The **Key Store** holds your app’s private key and certificate (client identity). Use it when the
SMTPS server requires client certificate authentication (mutual TLS).
Use it only if the mail server is configured to require a client certificate. Many SMTPS servers
(for example, Gmail with user or password) don’t require a keystore; they only need the truststore
to verify the server.
- Creating a keystore with keytool (for testing or when you need to generate a key and self-signed
cert):
```bash
keytool -genkeypair -alias muleclient -keyalg RSA -keysize 2048 -keystore keystore.jks -storepass changeit -validity 365 -dname "CN=MyApp, OU=IT, O=MyOrg, L=City, ST=State, C=US"
```
- For production you typically import an existing key and certificate (for example, from your PKI)
into a keystore; use `keytool -importcert` or import a PKCS12 file.
- In the Email Connector TLS configuration, set **Path** to the keystore file, **Password** to the
keystore password, and **Key Password** if the private key has a different password. Use **Alias**
if the keystore contains multiple keys.
### Summary
Purpose | Store | When to use |
Trust the mail server’s certificate | Truststore | Required for SMTPS (unless using insecure mode) |
Prove client identity to the server | Keystore | Only when the server requires client certificate authentication |
For full parameter details (Path, Password, Type, Algorithm, Insecure), see the
[Truststore](https://docs.mulesoft.com/email-connector/latest/email-documentation#TrustStore) and [Keystore](https://docs.mulesoft.com/email-connector/latest/email-documentation#KeyStore) sections
in the Email Connector Reference.
## Send an Attachment
This example illustrates how to send emails and attachments over the SMTP server. Use DataWeave to
manage the attachments. The flow reads a JSON file using the File Connector **Read** operation and
then uses the Email Connector **Send** operation to send the content of the file as an attachment:
The following screenshot shows the Anypoint Studio app flow for this example:

To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
The source initiates a flow when a time-based condition is met.
3. Drag the File Connector **Read** operation to the right of the **Scheduler** component.
4. Set **File Path** to `file.json`.
5. Drag the **Send** operation to the right of the **Read** operation.
6. On the **Send** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
7. For **Connection**, select **SMTP Connection**.
8. In the **General** tab, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user1@domain.com`
- **Password** `password`
9. Click **OK**.
10. In the **Send** operation configuration screen, set the **To addresses** field to `Edit inline`.
11. Click the plus sign (**+**) to add a new email **Value** as `example@domain.com`.
12. Set **Subject** to `Attachment test`.
13. Set **Content** to `"Hello this is an important message
"`.
14. In the **Attachments** field, enter the following DataWeave expression as a new attachment
element:
```DataWeave
{
'json-attachment' : payload
}
```
Note that `payload` is the content of the JSON file read by the File Connector **Read**
operation.
15. Save and run the app.

### XML for Sending Attachments
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
Hello this is an important message"]]]>
#[{
'json-attachment' : payload
}]
```
## Send Multiple Attachments
This example illustrates how to send emails and multiple attachments over the SMTP server. The flow
initiates with a **Scheduler** component. Then, **Set Variable** components define each attachment
media type JSON, text and file. Subsequently, the Email Connector **Send** operation sends the
attachments in the email, after which you the result message using a **Logger** component.
This screenshot shows the Anypoint Studio app flow for this example:

Figure 1. Email Connector Multiple attachments
To create the flow:
1. Create a new Mule project in Studio.
2. In the **Mule Palette** view, select the **Scheduler** component and drag it onto the canvas.
The source initiates a flow when a time-based condition is met and sends the emails.
3. Drag a **Set Variable** component to the right of the **Scheduler** component.
4. In the **Set Variable** configuration screen, set the following parameters:
- **Name** `json`
- **Value** `output application/json --- {address: '221B Baker Street'}`
- **MIME Type** `application/json`
5. Drag another **Set Variable** component to the right of the first **Set Variable** component,
and set the following parameters:
- **Name** `textPlain`
- **Value** `This is the email text attachment for John Watson`
- **MIME Type** `text/plain`
6. Drag another **Set Variable** component to the right of the second **Set Variable** component,
and set the following parameters:
- **Name** `octectStream`
- **Value** `vars.textPlain`
- **MIME Type** `application/octet-stream`
7. Drag the Email **Send** operation to the right of the third **Set Variable** component.
8. On the **Send** configuration screen, click the plus sign (**+**) next to the **Connector
configuration** field to configure a global element for the operation.
9. For **Connection**, select **SMTP Connection**.
10. In the **General** tab, enter the following values:
- **Host** `pop.gmail.com`
- **Port** `995`
- **User** `user1@domain.com`
- **Password** `password`
11. Click **OK**.
12. In the **Send** operation configuration screen, set the **To addresses** field to `Edit inline`
13. Click the plus sign (**+**) to add a new email **Value** as `user4@domain.com`.
14. Set the **Content** field to `Email Content` and the **ContentType** field to `text/plain`.
15. In the **Attachments** field, enter the following DataWeave expression:
```DataWeave
{
'text-attachment' : vars.textPlain,
'json-attachment' : vars.json,
'stream-attachment' : vars.octetStream
}
```
16. Save and run the app.

### XML for Sending Multiple Attachments
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:
```xml
Email Content
#[{
'text-attachment' : vars.textPlain,
'json-attachment' : vars.json,
'stream-attachment' : vars.octetStream
}]
```
## Send Attachments Received from a REST API
A common use case is accepting files (for example, a PDF, an MS Word document, and a JSON file
describing an incident) through a REST API and forwarding them to a support function by email. The
client sends a `multipart/form-data` POST request; each part is a file or a field (for example, an
incident description as JSON).
- Flow outline
An HTTP **Listener** (path for example, `/api/support/ticket`) receives the multipart request. The
payload is a multipart message; use `payload.parts.` to access each part. Build an
attachments map from the parts (using each part’s content and optionally filename from
`Content-Disposition`), then call Email **Send** with that map and the desired **To** address (for
example, [support@company.com](mailto:support@company.com)).
- Attachments map from multipart
Each part’s content is available as `payload.parts..content`. The filename (if present)
is in `payload.parts..headers.'Content-Disposition'.filename`. Use a DataWeave
expression to build a map: keys = attachment names (for example, original filename or a fixed
name), values = part content. The connector uses the part’s content type when available. Binary
parts (PDF, PNG, Word, and so on) are already Binary; the connector applies
Content-Transfer-Encoding (default Base64) for transport, so you do not need to encode them
yourself.
### Example: PDF, Word, and JSON Incident to Support
Assume the API expects three parts: `documentPdf`, `documentWord`, and `incidentJson`. This example
flow receives the request and sends the three as email attachments to support.
```xml
```
The client must POST to `/api/support/ticket` with `Content-Type: multipart/form-data` and three
parts named `documentPdf`, `documentWord`, and `incidentJson`. Each part’s content type (for
example, `application/pdf`,
`application/vnd.openxmlformats-officedocument.wordprocessingml.document`, `application/json`) is
preserved from the request and used for the corresponding email attachment.
## Send Files from an SFTP Server by Email
You may need to scan an SFTP directory and send the found files as email attachments to a function
or mailbox (for example a shared inbox or a processing service). There are two common patterns you
can follow:
- Use an **On New or Updated File** (SFTP Connector) to trigger a flow when a new or updated file
appears; read that file and send it (or a batch) by email.
- Use a **Scheduler** and SFTP **List** to poll a directory, then for each file (or for the whole
list), read the file(s) and send one or more emails with attachments.
In both cases, build the **Attachments** map from the file content. For a single file, the map can
be `{ filename : payload }` after an SFTP **Read**. For multiple files, collect them (for example,
in a **For Each** with **Set Variable** or a DataWeave transform) into a map of filename and content
and pass that map to **Attachments**.
### Example: Poll SFTP Directory and Email Files as Attachments
This example uses a **Scheduler** and SFTP **List** to list a directory, then a **For Each** to
process each item. For each file (non-directory), it reads the file and sends one email with that
file as a single attachment. The attachment name is taken from the file path (or attributes).
```xml
```
To send all listed files in a single email, first iterate to read each file and collect the name and
content into a variable (for example, using **Set Variable** with a DataWeave expression that merges
the current map with the new attachment), then call **Send** once with that variable as the
attachments map. The previous pattern sends one email per file for simplicity.
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/latest/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
keywords: anypoint, connectors, transports
---
# Set Parsing Text File Attachment as Body Message
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
When Anypoint Connector for Email (Email Connector) receives a message without a body and only an
attachment file with Content-Type as `text`, the attachment file is not processed as a separate
file. Instead, the file is included in the message body as plain text. Mule apps can use this
behavior to receive the data in the message body instead of as an attachment file.
To change the behavior of parsing attached text files when the file is the only content in the
message, set the system property `parsing.text.attachment.as.body` to either of these values:
- `true` (default)
Preserves the previous behavior and converts the text file attachment in the body message.
- `false`
Adds the attachment text file to the attachment list in the payload.
To learn how to set system properties in Anypoint Studio or for on-premises deployments, refer to
the [system properties](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-system) documentation.
## Jakarta Mail System Properties
Email Connector uses the Jakarta Mail library internally. Thereby, you can change certain aspects of
connector behavior by changing specific Jakarta Mail system properties. Refer to the
[troubleshoot Jakarta Mail system properties](https://docs.mulesoft.com/email-connector/1.7/email-troubleshooting#troubleshoot-jakarta-mail-system-properties)
section that covers some of the most used Jakarta Mail system properties.
For detailed information on these system properties, refer to the Jakarta Mail documentation.
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/1.7/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
keywords: anypoint, connectors, transports
---
# Set Parsing Text File Attachment as Body Message
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
When Anypoint Connector for Email (Email Connector) receives a message without a body and only an
attachment file with Content-Type as `text`, the attachment file is not processed as a separate
file. Instead, the file is included in the message body as plain text. Mule apps can use this
behavior to receive the data in the message body instead of as an attachment file.
To change the behavior of parsing attached text files when the file is the only content in the
message, set the system property `parsing.text.attachment.as.body` to either of these values:
- `true` (default)
Preserves the previous behavior and converts the text file attachment in the body message.
- `false`
Adds the attachment text file to the attachment list in the payload.
To learn how to set system properties in Anypoint Studio or for on-premises deployments, refer to
the [system properties](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-system) documentation.
## Jakarta Mail System Properties
Email Connector uses the Jakarta Mail library internally. Thereby, you can change certain aspects of
connector behavior by changing specific Jakarta Mail system properties. Refer to the
[troubleshoot Jakarta Mail system properties](https://docs.mulesoft.com/email-connector/latest/email-troubleshooting#troubleshoot-jakarta-mail-system-properties)
section that covers some of the most used Jakarta Mail system properties.
For detailed information on these system properties, refer to the Jakarta Mail documentation.
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/latest/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
---
# Trigger a Flow When Receiving a New Email Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
The following examples illustrate how you configure the Anypoint Connector for Email (Email
Connector) source listeners **On New Email - IMAP** and **On New Email - POP3** to identify and
retrieve unread email messages, initiating a flow.
Note that Email Connector currently doesn’t support multipart/signed (digitally signed) emails, and
they are not processed by **On New Email** listeners.
## Configure the Delete After Retrieve Parameter
Email Connector **On New Email - IMAP** and **On New Email - POP3** sources support the **Delete
after retrieve** parameter that enables the deletion of retrieved emails from the mailbox folder
after the operation process is complete. By deleting processed emails, you can ensure that the next
processed emails are new ones. Because the POP3 protocol doesn’t support watermarking, the **Delete
after retrieve** parameter is commonly used with this protocol.
The parameter is disabled by default to avoid deleting emails by mistake.
The following example shows how to configure this parameter in Anypoint Studio:
1. Select the **On New Email - IMAP** or **On New Email - POP3** source in the Studio canvas.
2. In the source configuration screen, enable the **Delete after retrieve** parameter.

In the **Configuration XML** editor, the configuration `deleteAfterRetrieve="true"` is under the
`listener-imap` tag:
```xml
```
The following screenshot shows the **Delete after retrieve** configuration for the **On New Email -
POP3** source:

In the **Configuration XML** editor, the configuration `deleteAfterRetrieve="true"` is under the
`listener-pop3` tag:
```xml
```
## Configure the Enable Watermark Parameter
Email Connector can watermark emails over the IMAP protocol by received date. The **On New Email -
IMAP** source supports the **Enable Watermark** parameter, causing only those messages containing
emails received after the last poll executed to be dispatched.
The following example shows how to configure this parameter in Anypoint Studio:
1. Select the **On New Email - IMAP** source in the Studio canvas.
2. On the source configuration screen, enable the **Enable Watermark** parameter.

In the **Configuration XML** editor, the configuration `watermark="true"` is under the
`listener-imap` tag:
```xml
```
## Configure the IMAP Matcher and POP3 Matcher Parameters
Email Connector **On New Email - IMAP** and **On New Email - POP3** sources support **Imap matcher**
and **Pop3 matcher** parameters that enable you to configure custom matchers and thereby provide
another way of filtering dispatched messages. Each source matcher can filter emails by dates,
addresses, subject, flags, and so on.
The following example shows how to configure these parameters in Anypoint Studio by dispatching all
messages that contain the word `IMPORTANT`:
1. Select the **On New Email - IMAP** or **On New Email - POP3** source in the Studio canvas.
2. On the source configuration screen, for the **Imap matcher** or **Pop3 matcher** parameters,
select either:
- **Edit inline**
Set all the inline fields **Seen**, **Answered**, **Deleted**, **Recent**, and so on.
- **Global reference**
Create a global reference configuration to automatically set all the inline fields.
3. Set the **Subject regex** field as `IMPORTANT`.

In the **Configuration XML** editor, the configuration `imap-matcher subjectRegex="IMPORTANT"` is
under the `listener-imap` tag:
```xml
```
## Configure the Attachment Naming Strategy Parameter
Email Connector **On New Email - IMAP**, **On New Email - POP3**, **List - IMAP**, and **List -
POP3** operations support the **Attachment naming strategy** parameter, which enables you to specify
a strategy for naming attachments. You can set the parameter in a global element or override it at
the operation level. The parameter has the following options: \* **NAME (Default)**
Email Connector names the attachment after the value of the `filename` field in the
`Content-Disposition` line of the attachment. If the `filename` field is not present or is empty,
then the attachment is named `Unnamed`. If multiple attachments have no name, they are called
`Unnamed`, `Unnamed_1`, `Unnamed_2`, and so on. \* **NAME\_HEADERS**
Email Connector first tries to obtain the name from the `filename` field in the
`Content-Disposition` line (the same as when using `NAME`). If that fails, the connector looks for
the `name` header in the `Content-Type` line of the attachment. If the `name` header is not present
or is empty, then the attachment is named `Unnamed`. \* **NAME\_HEADERS\_SUBJECT**
If both **NAME\_HEADERS** and **NAME\_HEADERS\_SUBJECT** fail, then the connector checks if the
attachment itself is an email (a nested message) and looks for the subject of the email. If the
subject is not empty, then the attachment is named after the subject. Otherwise, the attachment is
named `Unnamed`.
The following example shows how to configure this parameter in the global element:
1. In Studio, navigate to the **Global Element** view and click **Create** to open the **Choose
Global Type** window.
2. In the **Filter** box, type `email` and choose either **Email IMAP** or **Email POP3**, and
click **OK**.
3. In the **Global Element Properties** window, in the main **Advanced** tab, for the **Attachment
naming strategy** field, select one of the following options:
- **NAME**
- **NAME\_HEADERS**
- **NAME\_HEADERS\_SUBJECT**

4. In the **General** tab, for **Connection** select any of the connection types to provide to the
configuration.
5. Specify the connection information for the connector, such as **Host**, **Port**, and **TLS
configuration**.
6. On the subsequent **Advanced** tab, optionally specify timeout configuration and reconnection
information, including a reconnection strategy.
7. Click **OK**.
In the **Configuration XML** editor, the configuration `attachmentNamingStrategy="NAME"` is under
the `imap-config` tag:
```xml
```
The following example shows how to override the naming strategy at the **On New Email - IMAP**
source level:
1. Select the **On New Email - IMAP** source in the Studio canvas.
2. On the source configuration screen, in the **Advanced** tab, for the **Attachment naming
strategy** field select one of the following options:
- **NAME**
- **NAME\_HEADERS**
- **NAME\_HEADERS\_SUBJECT**

In the **Configuration XML** editor, the configuration `attachmentNamingStrategy="NAME"` is under
the `listener-imap` tag:
```xml
```
## Configure the Enable Remote Search for IMAP Matcher Parameter
When using the **On New Email - IMAP** source and **Imap matcher** parameter, you can specify
whether you want the filters to be applied server-side by enabling the **Enable Remote Search**
parameter.
This parameter is disabled by default because some email servers are not fully compliant with
`rfc-3501` search terms. Enabling the parameter decreases traffic by reducing the number of emails
sent to the client-side for processing.
For this feature to be fully functional, the email server should support the use of at least the
basic filtering flags: **Answered**, **Deleted**, **Seen** and **Recent**.
The following example shows how to configure this parameter in Anypoint Studio by enabling
server-side filtering to exclude all answered emails:
1. Select the **On New Email - IMAP** source in the Studio canvas.
2. In the source configuration screen, for the **Imap matcher**, select **Edit inline**.
3. In the **Answered** field, select the value **EXCLUDE**.
4. Enable the **Enable Remote Search** parameter.

In the **Configuration XML** editor, the configuration `remoteSearchFilterEnabled="true"` is under
the `listener-imap` tag:
```xml
```
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/1.7/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# Trigger a Flow When Receiving a New Email Examples
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
The following examples illustrate how you configure the Anypoint Connector for Email (Email
Connector) source listeners **On New Email - IMAP** and **On New Email - POP3** to identify and
retrieve unread email messages, initiating a flow.
Note that Email Connector currently doesn’t support multipart/signed (digitally signed) emails, and
they are not processed by **On New Email** listeners.
## Configure the Delete After Retrieve Parameter
Email Connector **On New Email - IMAP** and **On New Email - POP3** sources support the **Delete
after retrieve** parameter that enables the deletion of retrieved emails from the mailbox folder
after the operation process is complete. By deleting processed emails, you can ensure that the next
processed emails are new ones. Because the POP3 protocol doesn’t support watermarking, the **Delete
after retrieve** parameter is commonly used with this protocol.
The parameter is disabled by default to avoid deleting emails by mistake.
The following example shows how to configure this parameter in Anypoint Studio:
1. Select the **On New Email - IMAP** or **On New Email - POP3** source in the Studio canvas.
2. In the source configuration screen, enable the **Delete after retrieve** parameter.

In the **Configuration XML** editor, the configuration `deleteAfterRetrieve="true"` is under the
`listener-imap` tag:
```xml
```
The following screenshot shows the **Delete after retrieve** configuration for the **On New Email -
POP3** source:

In the **Configuration XML** editor, the configuration `deleteAfterRetrieve="true"` is under the
`listener-pop3` tag:
```xml
```
## Configure the Enable Watermark Parameter
Email Connector can watermark emails over the IMAP protocol by received date. The **On New Email -
IMAP** source supports the **Enable Watermark** parameter, causing only those messages containing
emails received after the last poll executed to be dispatched.
The following example shows how to configure this parameter in Anypoint Studio:
1. Select the **On New Email - IMAP** source in the Studio canvas.
2. On the source configuration screen, enable the **Enable Watermark** parameter.

In the **Configuration XML** editor, the configuration `watermark="true"` is under the
`listener-imap` tag:
```xml
```
## Configure the IMAP Matcher and POP3 Matcher Parameters
Email Connector **On New Email - IMAP** and **On New Email - POP3** sources support **Imap matcher**
and **Pop3 matcher** parameters that enable you to configure custom matchers and thereby provide
another way of filtering dispatched messages. Each source matcher can filter emails by dates,
addresses, subject, flags, and so on.
The following example shows how to configure these parameters in Anypoint Studio by dispatching all
messages that contain the word `IMPORTANT`:
1. Select the **On New Email - IMAP** or **On New Email - POP3** source in the Studio canvas.
2. On the source configuration screen, for the **Imap matcher** or **Pop3 matcher** parameters,
select either:
- **Edit inline**
Set all the inline fields **Seen**, **Answered**, **Deleted**, **Recent**, and so on.
- **Global reference**
Create a global reference configuration to automatically set all the inline fields.
3. Set the **Subject regex** field as `IMPORTANT`.

In the **Configuration XML** editor, the configuration `imap-matcher subjectRegex="IMPORTANT"` is
under the `listener-imap` tag:
```xml
```
## Configure the Attachment Naming Strategy Parameter
Email Connector **On New Email - IMAP**, **On New Email - POP3**, **List - IMAP**, and **List -
POP3** operations support the **Attachment naming strategy** parameter, which enables you to specify
a strategy for naming attachments. You can set the parameter in a global element or override it at
the operation level. The parameter has the following options: \* **NAME (Default)**
Email Connector names the attachment after the value of the `filename` field in the
`Content-Disposition` line of the attachment. If the `filename` field is not present or is empty,
then the attachment is named `Unnamed`. If multiple attachments have no name, they are called
`Unnamed`, `Unnamed_1`, `Unnamed_2`, and so on. \* **NAME\_HEADERS**
Email Connector first tries to obtain the name from the `filename` field in the
`Content-Disposition` line (the same as when using `NAME`). If that fails, the connector looks for
the `name` header in the `Content-Type` line of the attachment. If the `name` header is not present
or is empty, then the attachment is named `Unnamed`. \* **NAME\_HEADERS\_SUBJECT**
If both **NAME\_HEADERS** and **NAME\_HEADERS\_SUBJECT** fail, then the connector checks if the
attachment itself is an email (a nested message) and looks for the subject of the email. If the
subject is not empty, then the attachment is named after the subject. Otherwise, the attachment is
named `Unnamed`.
The following example shows how to configure this parameter in the global element:
1. In Studio, navigate to the **Global Element** view and click **Create** to open the **Choose
Global Type** window.
2. In the **Filter** box, type `email` and choose either **Email IMAP** or **Email POP3**, and
click **OK**.
3. In the **Global Element Properties** window, in the main **Advanced** tab, for the **Attachment
naming strategy** field, select one of the following options:
- **NAME**
- **NAME\_HEADERS**
- **NAME\_HEADERS\_SUBJECT**

4. In the **General** tab, for **Connection** select any of the connection types to provide to the
configuration.
5. Specify the connection information for the connector, such as **Host**, **Port**, and **TLS
configuration**.
6. On the subsequent **Advanced** tab, optionally specify timeout configuration and reconnection
information, including a reconnection strategy.
7. Click **OK**.
In the **Configuration XML** editor, the configuration `attachmentNamingStrategy="NAME"` is under
the `imap-config` tag:
```xml
```
The following example shows how to override the naming strategy at the **On New Email - IMAP**
source level:
1. Select the **On New Email - IMAP** source in the Studio canvas.
2. On the source configuration screen, in the **Advanced** tab, for the **Attachment naming
strategy** field select one of the following options:
- **NAME**
- **NAME\_HEADERS**
- **NAME\_HEADERS\_SUBJECT**

In the **Configuration XML** editor, the configuration `attachmentNamingStrategy="NAME"` is under
the `listener-imap` tag:
```xml
```
## Configure the Enable Remote Search for IMAP Matcher Parameter
When using the **On New Email - IMAP** source and **Imap matcher** parameter, you can specify
whether you want the filters to be applied server-side by enabling the **Enable Remote Search**
parameter.
This parameter is disabled by default because some email servers are not fully compliant with
`rfc-3501` search terms. Enabling the parameter decreases traffic by reducing the number of emails
sent to the client-side for processing.
For this feature to be fully functional, the email server should support the use of at least the
basic filtering flags: **Answered**, **Deleted**, **Seen** and **Recent**.
The following example shows how to configure this parameter in Anypoint Studio by enabling
server-side filtering to exclude all answered emails:
1. Select the **On New Email - IMAP** source in the Studio canvas.
2. In the source configuration screen, for the **Imap matcher**, select **Edit inline**.
3. In the **Answered** field, select the value **EXCLUDE**.
4. Enable the **Enable Remote Search** parameter.

In the **Configuration XML** editor, the configuration `remoteSearchFilterEnabled="true"` is under
the `listener-imap` tag:
```xml
```
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Email Connector Examples](https://docs.mulesoft.com/email-connector/latest/email-examples)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.7
---
# Troubleshooting Email Connector
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
To troubleshoot Anypoint Connector for Email (Email Connector), become familiar with the information
about app logs, JavaMail debugging, troubleshooting access attachments, troubleshooting protocols
issues, and interpreting commonly thrown messages.
## View the App Log
If you encounter problems while running your Mule runtime engine (Mule) app, view the app log as
follows:
- If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio
console window.
- If you’re running the app using Mule from the command line, the app log is visible in your OS
console.
Unless the log file path is customized in the app’s log file `log4j2.xml`, view the app log in the
default location `MULE_HOME/logs/.log`.
## Enable JavaMail Debug Logging
JavaMail debugging logging is used by underlying third-party classes.
To enable JavaMail debugging logging:
1. Access Anypoint Studio and navigate to the **Package Explorer** view.
2. Open your application’s project name.
3. Open the `src/main/mule` path folder.
4. Open your Mule app XML file inside the folder.
5. Add the `` to the IMAP or SMTP connection element.
```xml
```
6. Save your changes.
7. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule
Application**.
8. Navigate to the **Console** view to read the email messages in the logger:
```plain-text
DEBUG: JavaMail version 1.6.3
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle]
DEBUG IMAP: mail.imap.fetchsize: 16384
DEBUG IMAP: mail.imap.ignorebodystructuresize: false
DEBUG IMAP: trying to connect to host "******", port 993, isSSL true
* OK The Microsoft Exchange IMAP4 service is ready. [******]
A0 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
A0 OK CAPABILITY completed.
...
```
If you run the app in Anypoint Studio, the log output prints the debug lines in the console view.
If you run the app in a standalone Mule, the log output prints the debug lines in the log file.
## Enable Email Connector Debug Logging
To begin troubleshooting Email Connector, enable debug logging to see the exact error messages:
1. Access Anypoint Studio and navigate to the **Package Explorer** view.
2. Open your application’s project name.
3. Open the `src/main/resources` path folder.
4. Open the `log4j2.xml` file inside the folder.
5. If the following line is already in the `log4j2.xml` file, uncomment it to enable it; otherwise,
add it:
```xml
```
6. Save your changes.
7. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule
Application**.
8. Navigate to the **Console** view to read the Email Connector’s messages in the logger:
```plain-text
DEBUG 2021-04-26 18:51:08,536 [_pollingSource_imapattachmentFlow/executor.01] [processor: ; event: ] org.mule.extension.email.internal.mailbox.BaseMailboxPollingSource: Poll will be skipped, since last poll emails are still being processed
INFO 2021-04-26 18:51:09,166 [[MuleRuntime].uber.04: [imapattachment].imapattachmentFlow.CPU_LITE @111719e0] [processor: imapattachmentFlow/processors/1/processors/2; event: 820f7fe0-a6d9-11eb-a84b-147dda4dba09] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: "" as Binary {base: "64"}
DEBUG 2021-04-26 18:51:15,360 [_pollingSource_imapattachmentFlow/executor.01] [processor: ; event: ] org.mule.extension.email.internal.mailbox.BaseMailboxPollingSource: Email [172] was not processed.
....
```
### Email Connector Debug Logging for CloudHub 2 Mule Apps
Notice that for Mule apps deployed to CloudHub 2, in addition to the SMTP debug setting
(``), you must set this property to ensure the SMTP
debug logs are captured:
`forwardConsoleLogToAnypointMonitoring.enable=true`
This is necessary because SMTP debug logging uses the `java.util.logging` API to send logs to the
console, which differs from the `log4j2` logging used for other purposes, such as HTTP verbose
logging.
## Troubleshoot Parsing Text File Attachment as Body Message
When Email Connector receives a message without a body and only an attachment file with the
Content-Type as `text`, the connector publishes the text content as a payload body. To receive the
text file in the payload attachments list, set the `parsing.text.attachment.as.body` system property
to `false`. Refer to the [set parsing text file attachment as body message](https://docs.mulesoft.com/email-connector/1.7/email-attachment)
documentation for details.
## Troubleshoot Jakarta Mail System Properties
Email Connector uses the Java Mail library. Thereby, you can change certain aspects of connector
behavior by changing specific Jakarta Mail system properties, such as the MIME type and MIME
multipart properties. These properties control conformance to the MIME type specification.
Note that these properties are not session properties and you must set them globally as system
properties. To learn how to set system properties in Anypoint Studio or for on-premises deployments,
refer to the [system properties](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-system)
documentation.
### MIME Type System Properties
These are the most used Jakarta Mail MIME type system properties:
- `mail.mime.decodetext.strict`
Controls the decoding of MIME-encoded words. The MIME specification requires that encoded-words
start at the beginning of a whitespace-separated word. Some mailers incorrectly include
encoded-words in the middle of a word. If the `mail.mime.decodetext.strict` system property is set
to `false`, an attempt is made to decode these illegal encoded-words. Defaults to `true`.
- `mail.mime.encodeeol.strict`
Controls the choice of Content-Transfer-Encoding for MIME parts that are not of type `text`. Often
these MIME parts contain textual data for which an encoding that allows the normal end of line
conventions is appropriate. In rare cases, MIME parts that are not of type `text` appear to
contain entirely textual data but they require an encoding that preserves CR and LF characters
without change. If the `mail.mime.encodeeol.strict` system property is set to `true`,this type of
encoding is used when necessary. Defaults to `false`.
- `mail.mime.charset`
Specifies the default MIME charset to use for encoded words and text parts that don’t otherwise
the property specify a charset. Usually, the default MIME charset is derived from the default Java
charset, as specified in the `file.encoding` system property. Most applications do not need to
explicitly set the default MIME charset. Set this property when the default MIME charset to use
for mail messages is different than the charset used for files stored on the system.
- `mail.mime.ignoreunknownencoding`
Controls whether unknown values in the Content-Transfer-Encoding header, as passed to the decode
method, cause an exception. If set to `true`, unknown values are ignored and 8bit encoding is
assumed. Otherwise, unknown values throw a `MessagingException` exception.
### MIME Multipart System Properties
These are the most used Jakarta Mail MIME Multipart system properties:
- `mail.mime.multipart.ignoremissingendboundary`
Set this property to `false` to throw a `MessagingException` exception if the multipart data does
not end with the required end boundary line. If this property is set to `true` or not set at all,
missing end boundaries are not considered an error, and the final body part ends at the end of the
data.
- `mail.mime.multipart.ignoremissingboundaryparameter`\+ Set this property to `false` to throw a
`MessagingException` exception if the Content-Type of the MIME multipart does not include a
boundary parameter. If this property is set to `true` or not set at all, the multipart parsing
code searches for a line that looks like a boundary line and uses that line as the boundary
separating the parts.
- `mail.mime.multipart.ignoreexistingboundaryparameter`
Set this property to `true` to ignore any boundary and instead search for a boundary line in the
message as with the `mail.mime.multipart.ignoremissingboundaryparameter` system property.
- `mail.mime.multipart.allowempty`
Usually, when writing a MIME multipart that contains no body parts, or when trying to parse a
multipart message with no body parts, a `MessagingException` exception is thrown. The MIME type
specification does not allow multipart content with no body parts. Set the
`mail.mime.multipart.allowempty` system property to `true` to override this behavior. When writing
out such a MIME multipart, a single empty part is included. When reading such multipart, a MIME
multipart is created with no body parts.
## Troubleshoot SMTPS and Gmail Connection Issues
The method that you use to troubleshoot SMTPS connection issues depends on whether or not your Gmail
account uses two-factor authentication:
### Two-Factor Authentication
If your account uses two-factor authentication value, generate an app-specific password and use that
instead of your normal password. See
[Sign in Using App Password](https://support.google.com/accounts/answer/185833) for details. You do
not need to enable **Less Secure Apps** in your Gmail account.
### Password-Based Authentication
If your Gmail account does not use two-factor authentication, set up and enable **Less Secure Apps**
in your Gmail account, and if your password does not work, go to
[Allow Access to Your Google Account](https://accounts.google.com/b/0/DisplayUnlockCaptcha) and
follow these steps:
1. Enter your username and password.
2. Enter the letters on the captcha screen.
3. Return to your Mule app and rerun the flow.
## Understand the Behavior of the Different Protocols
If your problem is protocol behavior, check the RFC documents. A Request for Comments (RFC) is a
publication from the Internet Society (ISOC) and its associated bodies, most prominently the
Internet Engineering Task Force (IETF), the principal technical development and standards-setting
bodies for the internet. The IETF adopts some of the proposals published as RFCs as internet
standards. Some documents that you can check are:
- [RFC-5322 - Internet Message Format](https://datatracker.ietf.org/doc/html/rfc5322)
- [RFC-1064 - IMAP2 - INTERACTIVE MAIL ACCESS PROTOCOL - VERSION 2](https://datatracker.ietf.org/doc/html/rfc1064)
- [RFC-1939 - POP3 - Post Office Protocol - Version 3](https://datatracker.ietf.org/doc/html/rfc1939)
- [RFC-5321 - SMTP - Simple Mail Transfer Protocol](https://datatracker.ietf.org/doc/html/rfc5321)
- [RFC-2045 - MIME - Multipurpose Internet Mail Extensions Part One: Format of Internet Message Bodies](https://datatracker.ietf.org/doc/html/rfc2045)
## Understand Common Throws
Here is a list of common throw messages and how to interpret them:
- EMAIL:EMAIL\_NOT\_FOUND
The email identified by \`emailId\` cannot be found in a mailbox folder.
- EMAIL:ACCESSING\_FOLDER
There was a problem accessing an email folder or the folder does not exist.
- EMAIL:CONNECTIVITY
A connection could not be established.
- EMAIL:RETRY\_EXHAUSTED
A problem occurred during message routing.
- EMAIL:EMAIL\_LIST
An error occurred during an attempt to list emails.
- EMAIL:SEND
An exception occurred during an attempt to send an email.
- EMAIL:FETCHING\_ATTRIBUTES
An error occurred during email attribute parsing from an email.
- EMAIL:MARK
An error occurred during email flag marking.
- EMAIL:EXPUNGE\_ERROR
A error occurred during an attempt to delete emails from a folder.
- EMAIL:ATTACHMENT
An error occurred during an attempt to send an attachment.
- EMAIL:READ\_EMAIL
An error occurred during an attempt to read the email content.
- EMAIL:AUTHENTICATION
Authentication failed.
- EMAIL:INVALID\_CREDENTIALS
An error occurred during the username and password parameter consistency check.
- EMAIL:UNKNOWN\_HOST
The IP address of a host cannot be determined or a port is out of range.
- EMAIL:CONNECTION\_TIMEOUT
The server took too long to reply to a data request.
- EMAIL:DISCONNECTED
An error occurred during store connecting, or the connection was interrupted.
- EMAIL:SSL\_ERROR
An error occurred during SSL context creation, or the TLS context wasn't properly configured.
- EMAIL:EMAIL\_MOVE
An error occurred during an attempt to move the mail to the target folder.
- EMAIL:ILLEGAL\_ARGUMENT
An exception occurred while getting the list of emails due to an invalid parameter.
## See Also
- [Email Connector Reference](https://docs.mulesoft.com/email-connector/1.7/email-documentation)
- [Salesforce Help](https://help.salesforce.com)
- [Known Issues](https://help.salesforce.com/s/issues)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# Troubleshooting Email Connector
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
To troubleshoot Anypoint Connector for Email (Email Connector), become familiar with the information
about app logs, JavaMail debugging, troubleshooting access attachments, troubleshooting protocols
issues, and interpreting commonly thrown messages.
## View the App Log
If you encounter problems while running your Mule runtime engine (Mule) app, view the app log as
follows:
- If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio
console window.
- If you’re running the app using Mule from the command line, the app log is visible in your OS
console.
Unless the log file path is customized in the app’s log file `log4j2.xml`, view the app log in the
default location `MULE_HOME/logs/.log`.
## Enable JavaMail Debug Logging
JavaMail debugging logging is used by underlying third-party classes.
To enable JavaMail debugging logging:
1. Access Anypoint Studio and navigate to the **Package Explorer** view.
2. Open your application’s project name.
3. Open the `src/main/mule` path folder.
4. Open your Mule app XML file inside the folder.
5. Add the `` to the IMAP or SMTP connection element.
```xml
```
6. Save your changes.
7. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule
Application**.
8. Navigate to the **Console** view to read the email messages in the logger:
```plain-text
DEBUG: JavaMail version 1.6.3
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle]
DEBUG IMAP: mail.imap.fetchsize: 16384
DEBUG IMAP: mail.imap.ignorebodystructuresize: false
DEBUG IMAP: trying to connect to host "******", port 993, isSSL true
* OK The Microsoft Exchange IMAP4 service is ready. [******]
A0 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
A0 OK CAPABILITY completed.
...
```
If you run the app in Anypoint Studio, the log output prints the debug lines in the console view.
If you run the app in a standalone Mule, the log output prints the debug lines in the log file.
## Enable Email Connector Debug Logging
To begin troubleshooting Email Connector, enable debug logging to see the exact error messages:
1. Access Anypoint Studio and navigate to the **Package Explorer** view.
2. Open your application’s project name.
3. Open the `src/main/resources` path folder.
4. Open the `log4j2.xml` file inside the folder.
5. If the following line is already in the `log4j2.xml` file, uncomment it to enable it; otherwise,
add it:
```xml
```
6. Save your changes.
7. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule
Application**.
8. Navigate to the **Console** view to read the Email Connector’s messages in the logger:
```plain-text
DEBUG 2021-04-26 18:51:08,536 [_pollingSource_imapattachmentFlow/executor.01] [processor: ; event: ] org.mule.extension.email.internal.mailbox.BaseMailboxPollingSource: Poll will be skipped, since last poll emails are still being processed
INFO 2021-04-26 18:51:09,166 [[MuleRuntime].uber.04: [imapattachment].imapattachmentFlow.CPU_LITE @111719e0] [processor: imapattachmentFlow/processors/1/processors/2; event: 820f7fe0-a6d9-11eb-a84b-147dda4dba09] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: "" as Binary {base: "64"}
DEBUG 2021-04-26 18:51:15,360 [_pollingSource_imapattachmentFlow/executor.01] [processor: ; event: ] org.mule.extension.email.internal.mailbox.BaseMailboxPollingSource: Email [172] was not processed.
....
```
### Email Connector Debug Logging for CloudHub 2 Mule Apps
Notice that for Mule apps deployed to CloudHub 2, in addition to the SMTP debug setting
(``), you must set this property to ensure the SMTP
debug logs are captured:
`forwardConsoleLogToAnypointMonitoring.enable=true`
This is necessary because SMTP debug logging uses the `java.util.logging` API to send logs to the
console, which differs from the `log4j2` logging used for other purposes, such as HTTP verbose
logging.
## Troubleshoot Parsing Text File Attachment as Body Message
When Email Connector receives a message without a body and only an attachment file with the
Content-Type as `text`, the connector publishes the text content as a payload body. To receive the
text file in the payload attachments list, set the `parsing.text.attachment.as.body` system property
to `false`. Refer to the [set parsing text file attachment as body message](https://docs.mulesoft.com/email-connector/latest/email-attachment)
documentation for details.
## Troubleshoot Jakarta Mail System Properties
Email Connector uses the Java Mail library. Thereby, you can change certain aspects of connector
behavior by changing specific Jakarta Mail system properties, such as the MIME type and MIME
multipart properties. These properties control conformance to the MIME type specification.
Note that these properties are not session properties and you must set them globally as system
properties. To learn how to set system properties in Anypoint Studio or for on-premises deployments,
refer to the [system properties](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-system)
documentation.
### MIME Type System Properties
These are the most used Jakarta Mail MIME type system properties:
- `mail.mime.decodetext.strict`
Controls the decoding of MIME-encoded words. The MIME specification requires that encoded-words
start at the beginning of a whitespace-separated word. Some mailers incorrectly include
encoded-words in the middle of a word. If the `mail.mime.decodetext.strict` system property is set
to `false`, an attempt is made to decode these illegal encoded-words. Defaults to `true`.
- `mail.mime.encodeeol.strict`
Controls the choice of Content-Transfer-Encoding for MIME parts that are not of type `text`. Often
these MIME parts contain textual data for which an encoding that allows the normal end of line
conventions is appropriate. In rare cases, MIME parts that are not of type `text` appear to
contain entirely textual data but they require an encoding that preserves CR and LF characters
without change. If the `mail.mime.encodeeol.strict` system property is set to `true`,this type of
encoding is used when necessary. Defaults to `false`.
- `mail.mime.charset`
Specifies the default MIME charset to use for encoded words and text parts that don’t otherwise
the property specify a charset. Usually, the default MIME charset is derived from the default Java
charset, as specified in the `file.encoding` system property. Most applications do not need to
explicitly set the default MIME charset. Set this property when the default MIME charset to use
for mail messages is different than the charset used for files stored on the system.
- `mail.mime.ignoreunknownencoding`
Controls whether unknown values in the Content-Transfer-Encoding header, as passed to the decode
method, cause an exception. If set to `true`, unknown values are ignored and 8bit encoding is
assumed. Otherwise, unknown values throw a `MessagingException` exception.
### MIME Multipart System Properties
These are the most used Jakarta Mail MIME Multipart system properties:
- `mail.mime.multipart.ignoremissingendboundary`
Set this property to `false` to throw a `MessagingException` exception if the multipart data does
not end with the required end boundary line. If this property is set to `true` or not set at all,
missing end boundaries are not considered an error, and the final body part ends at the end of the
data.
- `mail.mime.multipart.ignoremissingboundaryparameter`\+ Set this property to `false` to throw a
`MessagingException` exception if the Content-Type of the MIME multipart does not include a
boundary parameter. If this property is set to `true` or not set at all, the multipart parsing
code searches for a line that looks like a boundary line and uses that line as the boundary
separating the parts.
- `mail.mime.multipart.ignoreexistingboundaryparameter`
Set this property to `true` to ignore any boundary and instead search for a boundary line in the
message as with the `mail.mime.multipart.ignoremissingboundaryparameter` system property.
- `mail.mime.multipart.allowempty`
Usually, when writing a MIME multipart that contains no body parts, or when trying to parse a
multipart message with no body parts, a `MessagingException` exception is thrown. The MIME type
specification does not allow multipart content with no body parts. Set the
`mail.mime.multipart.allowempty` system property to `true` to override this behavior. When writing
out such a MIME multipart, a single empty part is included. When reading such multipart, a MIME
multipart is created with no body parts.
## Troubleshoot SMTPS and Gmail Connection Issues
The method that you use to troubleshoot SMTPS connection issues depends on whether or not your Gmail
account uses two-factor authentication:
### Two-Factor Authentication
If your account uses two-factor authentication value, generate an app-specific password and use that
instead of your normal password. See
[Sign in Using App Password](https://support.google.com/accounts/answer/185833) for details. You do
not need to enable **Less Secure Apps** in your Gmail account.
### Password-Based Authentication
If your Gmail account does not use two-factor authentication, set up and enable **Less Secure Apps**
in your Gmail account, and if your password does not work, go to
[Allow Access to Your Google Account](https://accounts.google.com/b/0/DisplayUnlockCaptcha) and
follow these steps:
1. Enter your username and password.
2. Enter the letters on the captcha screen.
3. Return to your Mule app and rerun the flow.
## Understand the Behavior of the Different Protocols
If your problem is protocol behavior, check the RFC documents. A Request for Comments (RFC) is a
publication from the Internet Society (ISOC) and its associated bodies, most prominently the
Internet Engineering Task Force (IETF), the principal technical development and standards-setting
bodies for the internet. The IETF adopts some of the proposals published as RFCs as internet
standards. Some documents that you can check are:
- [RFC-5322 - Internet Message Format](https://datatracker.ietf.org/doc/html/rfc5322)
- [RFC-1064 - IMAP2 - INTERACTIVE MAIL ACCESS PROTOCOL - VERSION 2](https://datatracker.ietf.org/doc/html/rfc1064)
- [RFC-1939 - POP3 - Post Office Protocol - Version 3](https://datatracker.ietf.org/doc/html/rfc1939)
- [RFC-5321 - SMTP - Simple Mail Transfer Protocol](https://datatracker.ietf.org/doc/html/rfc5321)
- [RFC-2045 - MIME - Multipurpose Internet Mail Extensions Part One: Format of Internet Message Bodies](https://datatracker.ietf.org/doc/html/rfc2045)
## Understand Common Throws
Here is a list of common throw messages and how to interpret them:
- EMAIL:EMAIL\_NOT\_FOUND
The email identified by \`emailId\` cannot be found in a mailbox folder.
- EMAIL:ACCESSING\_FOLDER
There was a problem accessing an email folder or the folder does not exist.
- EMAIL:CONNECTIVITY
A connection could not be established.
- EMAIL:RETRY\_EXHAUSTED
A problem occurred during message routing.
- EMAIL:EMAIL\_LIST
An error occurred during an attempt to list emails.
- EMAIL:SEND
An exception occurred during an attempt to send an email.
- EMAIL:FETCHING\_ATTRIBUTES
An error occurred during email attribute parsing from an email.
- EMAIL:MARK
An error occurred during email flag marking.
- EMAIL:EXPUNGE\_ERROR
A error occurred during an attempt to delete emails from a folder.
- EMAIL:ATTACHMENT
An error occurred during an attempt to send an attachment.
- EMAIL:READ\_EMAIL
An error occurred during an attempt to read the email content.
- EMAIL:AUTHENTICATION
Authentication failed.
- EMAIL:INVALID\_CREDENTIALS
An error occurred during the username and password parameter consistency check.
- EMAIL:UNKNOWN\_HOST
The IP address of a host cannot be determined or a port is out of range.
- EMAIL:CONNECTION\_TIMEOUT
The server took too long to reply to a data request.
- EMAIL:DISCONNECTED
An error occurred during store connecting, or the connection was interrupted.
- EMAIL:SSL\_ERROR
An error occurred during SSL context creation, or the TLS context wasn't properly configured.
- EMAIL:EMAIL\_MOVE
An error occurred during an attempt to move the mail to the target folder.
- EMAIL:ILLEGAL\_ARGUMENT
An exception occurred while getting the list of emails due to an invalid parameter.
## See Also
- [Email Connector Reference](https://docs.mulesoft.com/email-connector/latest/email-documentation)
- [Salesforce Help](https://help.salesforce.com)
- [Known Issues](https://help.salesforce.com/s/issues)
---
product: Email Connector
version: 1.7
---
# Using Anypoint Studio to Configure Email Connector 1.7
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and
configuration files.
To add and configure a connector in Studio:
1. [Create a Mule project](#create-mule-project).
2. [Add the connector to your Mule project](#add-connector-to-project).
3. [Configure a source for the connector’s flow](#configure-input-source).
4. [Add a connector operation to the flow](#add-connector-operation).
5. [Configure a global element for the connector](#configure-global-element).
6. [Configure the other connector fields](#configure-other-fields).
When you run the connector, you can view the app log to check for problems, as described in
[View the App Log](#view-app-log).
If you are new to configuring connectors in Studio, see
[Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio).
If, after reading this topic, you need additional information about the connector fields, see the
[Email Connector Reference](https://docs.mulesoft.com/email-connector/1.7/email-documentation).
## Create a Mule Project
In Studio, create a new Mule project in which to add and configure the connector:
1. In Studio, select **File > New > Mule Project**.
2. Enter a name for your Mule project and click **Finish**.
## Add the Connector to Your Mule Project
Add Email Connector to your Mule project to automatically populate the XML code with the connector’s
namespace and schema location and to add the required dependencies to the project’s `pom.xml` file:
1. In the **Mule Palette** view, click **(X) Search in Exchange**.
2. In the **Add Dependencies to Project** window, type `email` in the search field.
3. Click **Email Connector** in **Available modules**.
4. Click **Add**.
5. Click **Finish**.
Adding a connector to a Mule project in Studio does not make that connector available to other
projects in your Studio workspace.
## Configure a Source
A source initiates a flow when a specified condition is met. You can configure one of these input
sources to use with Email Connector:
- **On New Email - IMAP**
Initiates a flow by retrieving all the emails from an IMAP mailbox folder, watermark can be
enabled for polled items
- **On New Email - POP3**
Initiates a flow by retrieving all the emails from an POP3 mailbox folder
- **HTTP > Listener**
Initiates a flow each time it receives a request on the configured host and port
- **Scheduler**
Initiates a flow when a time-based condition is met
For example, to configure the **On New Email - IMAP** source , follow these steps:
1. In the **Mule Palette** view, select **Email > On New Email - IMAP**.
2. Drag **On New Email - IMAP** to the Studio canvas.
3. On the **On New Email - IMAP** configuration screen, optionally change the value of the
**Display Name** field.
4. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global
element that can be used by all instances of the source in the app.
5. On the **Email IMAP** window, for **Connection** select any of the connection types to provide
to this configuration:
- **IMAP Connection**
- **IMAPS Connection**
6. On the **General** tab, specify the connection information for the connector, such as **Host**,
**Port** and **TLS configuration**.
7. On the **Advanced** tab, optionally specify timeout configuration and reconnection information,
including a reconnection strategy.
8. Click **OK**.
9. On the **On New Email - IMAP** configuration screen, in the **General** section, select a
**Scheduling Strategy** to configure the scheduler that triggers the polling.
## Add a Connector Operation to the Flow
When you add a connector operation to your flow, you immediately define a specific operation for
that connector to perform.
To add an operation for Email Connector, follow these steps:
1. In the **Mule Palette** view, select **Email** and then select the desired operation.
2. Drag the operation onto the Studio canvas and to the right of the input source.

## Configure a Global Element for the Connector
When you configure a connector, it’s best to configure a global element that all instances of that
connector in the app can use. Configuring a global element for Email Connector requires you to set a
configuration based on the supported protocols for the connector operations:
| Global Element Configuration | Connector Operation/Sources |
|---|
IMAP (Internet Message Access Protocol) | Delete Expunge Folder List - IMAP Mark As Deleted Mark As Read On New Email - IMAP
|
POP3 (Post Office Protocol 3) | List POP3 On New Email - POP3
|
SMTP (Simple Mail Transfer Protocol) | |
For example, to configure a POP3 global element for the **List POP3** operation, follow these steps:
1. Select the name of the connector in the Studio canvas.
2. Select the **List POP3** operation in the Studio canvas.
3. In the **List POP3** configuration screen for the operation, click the plus sign (**+**) next to
the **Connector configuration** field to access the global element configuration fields. On the
**Email POP3** window, for **Connection** select any of the connection types to provide to this
configuration:
- **POP3 Connection**
- **POP3S Connection**
4. On the **General** tab, specify the connection information for the connector, such as **Host**,
**Port** and **TLS configuration**.
5. On the **Advanced** tab, optionally specify timeout configuration and reconnection information,
including a reconnection strategy.
6. Click **OK**.

## Configure Additional Connector Fields
For IMAPS, POP3S, and SMTPS protocol connections, you can use Transport Layer Security (TLS) and
configure email by providing a key store with your certificate. Additionally, you can also enable
two-way authentication by providing a trust store. For details, see
[Email Connector Reference](https://docs.mulesoft.com/email-connector/1.7/email-documentation#Tls) and
[Configure TLS with Keystores and Truststores](https://docs.mulesoft.com/mule-runtime/latest/tls-configuration).
## View the App Log
To check for problems, you can view the app log as follows:
- If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio
console window.
- If you’re running the app using Mule from the command line, the app log is visible in your OS
console.
Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the
app log in the default location `MULE_HOME/logs/.log`.
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio)
- [Email Connector Reference](https://docs.mulesoft.com/email-connector/1.7/email-documentation)
- [Salesforce Help](https://help.salesforce.com)
---
product: Email Connector
version: 1.8
is-latest-version: true
---
# Using Anypoint Studio to Configure Email Connector 1.8
> For the full documentation index, see: https://docs.mulesoft.com/llms.txt
Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and
configuration files.
To add and configure a connector in Studio:
1. [Create a Mule project](#create-mule-project).
2. [Add the connector to your Mule project](#add-connector-to-project).
3. [Configure a source for the connector’s flow](#configure-input-source).
4. [Add a connector operation to the flow](#add-connector-operation).
5. [Configure a global element for the connector](#configure-global-element).
6. [Configure the other connector fields](#configure-other-fields).
When you run the connector, you can view the app log to check for problems, as described in
[View the App Log](#view-app-log).
If you are new to configuring connectors in Studio, see
[Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio).
If, after reading this topic, you need additional information about the connector fields, see the
[Email Connector Reference](https://docs.mulesoft.com/email-connector/latest/email-documentation).
## Create a Mule Project
In Studio, create a new Mule project in which to add and configure the connector:
1. In Studio, select **File > New > Mule Project**.
2. Enter a name for your Mule project and click **Finish**.
## Add the Connector to Your Mule Project
Add Email Connector to your Mule project to automatically populate the XML code with the connector’s
namespace and schema location and to add the required dependencies to the project’s `pom.xml` file:
1. In the **Mule Palette** view, click **(X) Search in Exchange**.
2. In the **Add Dependencies to Project** window, type `email` in the search field.
3. Click **Email Connector** in **Available modules**.
4. Click **Add**.
5. Click **Finish**.
Adding a connector to a Mule project in Studio does not make that connector available to other
projects in your Studio workspace.
## Configure a Source
A source initiates a flow when a specified condition is met. You can configure one of these input
sources to use with Email Connector:
- **On New Email - IMAP**
Initiates a flow by retrieving all the emails from an IMAP mailbox folder, watermark can be
enabled for polled items
- **On New Email - POP3**
Initiates a flow by retrieving all the emails from an POP3 mailbox folder
- **HTTP > Listener**
Initiates a flow each time it receives a request on the configured host and port
- **Scheduler**
Initiates a flow when a time-based condition is met
For example, to configure the **On New Email - IMAP** source , follow these steps:
1. In the **Mule Palette** view, select **Email > On New Email - IMAP**.
2. Drag **On New Email - IMAP** to the Studio canvas.
3. On the **On New Email - IMAP** configuration screen, optionally change the value of the
**Display Name** field.
4. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global
element that can be used by all instances of the source in the app.
5. On the **Email IMAP** window, for **Connection** select any of the connection types to provide
to this configuration:
- **IMAP Connection**
- **IMAPS Connection**
6. On the **General** tab, specify the connection information for the connector, such as **Host**,
**Port** and **TLS configuration**.
7. On the **Advanced** tab, optionally specify timeout configuration and reconnection information,
including a reconnection strategy.
8. Click **OK**.
9. On the **On New Email - IMAP** configuration screen, in the **General** section, select a
**Scheduling Strategy** to configure the scheduler that triggers the polling.
## Add a Connector Operation to the Flow
When you add a connector operation to your flow, you immediately define a specific operation for
that connector to perform.
To add an operation for Email Connector, follow these steps:
1. In the **Mule Palette** view, select **Email** and then select the desired operation.
2. Drag the operation onto the Studio canvas and to the right of the input source.

## Configure a Global Element for the Connector
When you configure a connector, it’s best to configure a global element that all instances of that
connector in the app can use. Configuring a global element for Email Connector requires you to set a
configuration based on the supported protocols for the connector operations:
| Global Element Configuration | Connector Operation/Sources |
|---|
IMAP (Internet Message Access Protocol) | Delete Expunge Folder List - IMAP Mark As Deleted Mark As Read On New Email - IMAP
|
POP3 (Post Office Protocol 3) | List POP3 On New Email - POP3
|
SMTP (Simple Mail Transfer Protocol) | |
For example, to configure a POP3 global element for the **List POP3** operation, follow these steps:
1. Select the name of the connector in the Studio canvas.
2. Select the **List POP3** operation in the Studio canvas.
3. In the **List POP3** configuration screen for the operation, click the plus sign (**+**) next to
the **Connector configuration** field to access the global element configuration fields. On the
**Email POP3** window, for **Connection** select any of the connection types to provide to this
configuration:
- **POP3 Connection**
- **POP3S Connection**
4. On the **General** tab, specify the connection information for the connector, such as **Host**,
**Port** and **TLS configuration**.
5. On the **Advanced** tab, optionally specify timeout configuration and reconnection information,
including a reconnection strategy.
6. Click **OK**.

## Configure Additional Connector Fields
For IMAPS, POP3S, and SMTPS protocol connections, you can use Transport Layer Security (TLS) and
configure email by providing a key store with your certificate. Additionally, you can also enable
two-way authentication by providing a trust store. For details, see
[Email Connector Reference](https://docs.mulesoft.com/email-connector/latest/email-documentation#Tls) and
[Configure TLS with Keystores and Truststores](https://docs.mulesoft.com/mule-runtime/latest/tls-configuration).
## View the App Log
To check for problems, you can view the app log as follows:
- If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio
console window.
- If you’re running the app using Mule from the command line, the app log is visible in your OS
console.
Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the
app log in the default location `MULE_HOME/logs/.log`.
## See Also
- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio)
- [Email Connector Reference](https://docs.mulesoft.com/email-connector/latest/email-documentation)
- [Salesforce Help](https://help.salesforce.com)