# Get mails (POP3/IMAP)

### Description

The `Get mails (POP3/IMAP)` action retrieves mails from a POP3 or IMAP server and stores them into one or more files.

### Options

#### General tab

| Option                          | Description                                                                                                                                                                                                                                             |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Mail Server Connection**      |                                                                                                                                                                                                                                                         |
| Mail Connection                 | If a mail server connection is selected here, the rest of this tab is ignored. The server configuration will be taken from the [Mail Server Connection](https://hop.apache.org/manual/2.14.0/metadata-types/mail-server-connection.html) metadata item. |
| Server Settings                 |                                                                                                                                                                                                                                                         |
| Workflow action name            | The name of the workflow action.                                                                                                                                                                                                                        |
| Source Host                     | The host name or IP-address of the pop server.                                                                                                                                                                                                          |
| Use SSL                         | If checked A secure connection will be used to communicate with the server.                                                                                                                                                                             |
| Use XOAUTH2                     | If checked XOAuth2 will be used to authenticate with the server.                                                                                                                                                                                        |
| Port                            | The port to run the SSL POP3 or IMAP connection over.                                                                                                                                                                                                   |
| Username                        | The username to log in with.                                                                                                                                                                                                                            |
| Password                        | The password to log in with.                                                                                                                                                                                                                            |
| Use proxy                       | check to enable proxy authentication                                                                                                                                                                                                                    |
| Proxy username                  | proxy authorised user (only available if `Use proxy` is checked)                                                                                                                                                                                        |
| Protocol                        | <p>Choose between</p><ul><li>POP3</li><li>IMAP</li><li>MBOX</li></ul>                                                                                                                                                                                   |
| Test connection                 | Click this button to test the provided settings                                                                                                                                                                                                         |
| Target folder                   |                                                                                                                                                                                                                                                         |
| Target directory                | The directory in which you want to put the mail files.                                                                                                                                                                                                  |
| Create folder                   | check to create the specified target directory if it doesn’t exist                                                                                                                                                                                      |
| Target filename pattern         | The filename pattern (start of filename). The default pattern is `name_{SYS\|hhmmss_MMddyyyy\|}_#IdFile#.mail`                                                                                                                                          |
| Save message content            | check to save the message body text for retrieved email messages                                                                                                                                                                                        |
| Get mail attachment             | check to save the attachments for retrieved email messages                                                                                                                                                                                              |
| Different folder for attachment | check to save the attachments for retrieved email messages in a different folder than the message body                                                                                                                                                  |
| Attachment files folder         | the folder to store attachments for retrieved email messages in (only available if `Different folder for attachment` is checked)                                                                                                                        |
| Attachment wildcard             | the wildcard to use to save attachments for retrieved email messages (none = all)                                                                                                                                                                       |

#### Settings tab

| Option                        | Description                                                                                                                                                                                                                                                                                                                                            |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Action                        | <p>This dropdown box lets you specify the action to perform on the retrieved email messages:</p><p>\* Get messages \* Move messages to folder (IMAP only since POP3 only knows one folder "INBOX") \* Delete messages</p>                                                                                                                              |
| POP3 settings                 |                                                                                                                                                                                                                                                                                                                                                        |
| Retrieve                      | <p>Select the e-mails to retrieve:</p><ul><li>All emails</li><li>Retrieve first …​ emails</li></ul>                                                                                                                                                                                                                                                    |
| Retrieve the .. first emails  | Allows you to specify the number of emails to retrieve if "first …​ emails" is selected.                                                                                                                                                                                                                                                               |
| Delete emails after retrieval | check to delete the mails on the pop server after retrieval.                                                                                                                                                                                                                                                                                           |
| IMAP settings                 |                                                                                                                                                                                                                                                                                                                                                        |
| Option                        | Description                                                                                                                                                                                                                                                                                                                                            |
| IMAP folder                   | the folder on the IMAP server to retrieve messages from                                                                                                                                                                                                                                                                                                |
| Include subfolders            | check to select messages for subfolders from the selected IMAP folder                                                                                                                                                                                                                                                                                  |
| Retrieve                      | <p>choose one of</p><ul><li>Get all messages</li><li>Get new messages</li><li>Get old messages</li><li>Get read messages</li><li>Get unread messages</li><li>Get flagged messages</li><li>Get not flagged messages</li><li>Get draft messages</li><li>Get not draft messages</li><li>Get answered messages</li><li>Get not answered messages</li></ul> |
| Retrieve the first…​emails    | specify the number of messages to retrieve                                                                                                                                                                                                                                                                                                             |
| After retrieved               | <p>specfiy the action to perform on email messages after retrieval:</p><ul><li>Do nothing</li><li>Delete message</li><li>Move message to folder</li></ul>                                                                                                                                                                                              |
| Move to folder                | move the retrieved messages to a different folder on the IMAP server (if `Move message to folder` was selected)                                                                                                                                                                                                                                        |
| Create folder                 | create a folder on the IMAP server to move the messages to if it doesn’t exist.                                                                                                                                                                                                                                                                        |

#### Filters tab

| Option         | Description                                                                                                                                                                                                                                                                                                     |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Header         |                                                                                                                                                                                                                                                                                                                 |
| Sender (FROM)  | messages will be filtered on sender                                                                                                                                                                                                                                                                             |
| Recipient (TO) | messages will be filtered on recipient                                                                                                                                                                                                                                                                          |
| Subject        | messages will be filtered on subject                                                                                                                                                                                                                                                                            |
| Content        |                                                                                                                                                                                                                                                                                                                 |
| Option         | Description                                                                                                                                                                                                                                                                                                     |
| Body           | messages will be filtered on the specified text in the email body                                                                                                                                                                                                                                               |
| Received date  |                                                                                                                                                                                                                                                                                                                 |
| Option         | Description                                                                                                                                                                                                                                                                                                     |
| Condition      | <p>Choose a date or date range. The available options are</p><ul><li>None (default, don’t filter on received date)</li><li>Equal to <code>Date 1</code></li><li>Smaller than <code>Date 1</code></li><li>Greater than <code>Date 1</code></li><li>Between <code>Date 1</code> and <code>Date 2</code></li></ul> |


---

# Agent Instructions: Querying This Documentation

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

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

```
GET https://docs.primeur.com/data-shaper-1.21/knowing-the-data-shaper-designer/workflows/actions/getpop.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

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