> For the complete documentation index, see [llms.txt](https://docs.frends.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frends.com/tasks/tasks/imap/reademail.md).

# ReadEmail

Frends task, that allows to read emails from IMAP server and

Task version: 2.3.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.IMAP>

## Task Parameters

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

| Name                       | Description                                                                                                                                            |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Host : `String`            | <p>Host address</p><p><br>Default: <code>imap.frends.com</code><br>Example: <code>imap.frends.com</code></p>                                           |
| Port : `Int32`             | <p>Host port</p><p><br>Default: <code>993</code><br>Example: <code>993</code></p>                                                                      |
| UseSSL : `Boolean`         | <p>Use SSL or not</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                               |
| AcceptAllCerts : `Boolean` | <p>Controls whether task will save attachments to designated directory or not</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p> |
| UserName : `String`        | <p>Account name to login with</p><p><br>Default: <code>accountName</code><br>Example: <code>user</code></p>                                            |
| 🗝Password : `String`      | <p>Account password</p><p><br>Default: <code>-</code><br>Example: <code>\*\*\*</code></p>                                                              |
| {% endtab %}               |                                                                                                                                                        |

{% tab title="Options" %}

| Name                                  | Description                                                                                                                                                                                                                                        |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MaxEmails : `Int32`                   | <p>Maximum number of emails to retrieve</p><p><br>Default: <code>10</code><br>Example: <code>10</code></p>                                                                                                                                         |
| GetOnlyUnreadEmails : `Boolean`       | <p>Should get only unread emails?</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p>                                                                                                                                             |
| MarkEmailsAsRead : `Boolean`          | <p>If true, then marks queried emails as read</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p>                                                                                                                                 |
| DeleteReadEmails : `Boolean`          | <p>If true, then received, read emails will be hard deleted.</p><p>Note: If MarkEmailsAsRead is false, then this option will delete only those emails that were already read.</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p> |
| SaveAttachments : `Boolean`           | <p>Controls whether task will save attachments to designated directory or not</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                             |
| SavedAttachmentsDirectory : `String`  | <p>Directory to store all attachments</p><p><br>Default: <code>c:/SavedAttachments</code><br>Example: <code>c:/SavedAttachments</code></p>                                                                                                         |
| CreateDirectoryIfNotFound : `Boolean` | <p>If true, then creates an attachment directory if not existing</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                          |
| {% endtab %}                          |                                                                                                                                                                                                                                                    |
| {% endtabs %}                         |                                                                                                                                                                                                                                                    |

## Task Result

| Name                          | Description                         |
| ----------------------------- | ----------------------------------- |
| Emails : `List<EmailMessage>` | List of emails that were retrieved. |

## Task Changelog

Changelog for Task Frends.IMAP.ReadEmail.

### \[2.3.0] - 2026-10-02

#### Changed

* Upgraded project to target .NET 8

### \[2.2.0] - 2026-05-21

#### Fixed

* Ensure to delete only emails flagged as Read

### \[2.1.0] - 2026-02-23

#### Fixed

* Ensure FrendsTaskMetadata.json is included in NuGet package

### \[2.0.0] - 2023-06-12

#### Fixed

* Fixed task not handling attachments at all (#3).
* Added better description of task.

#### Changed

* Breaking change! Result is change from just a list of messages to a wrapper that contains an `Emails` subproperty with the list of messages.

### \[1.0.0] - 2022-02-09

#### Added

* Initial implementation


---

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

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.frends.com/tasks/tasks/imap/reademail.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
