# MailSource

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Reference](https://developer.m-files.com/APIs/gRPC-API/Reference/index.md) > [Messages](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.MailSource/

Mail source specific fields.

- **Full name:** `MFiles.MailSource`
- **Proto file:** [`mfiles/structs.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/structs.proto)

<a id="fields"></a>

## Fields

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="f-protocol"></a>`protocol` | [`MailProtocol`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.MailProtocol/index.md) | 1 | The e-mail protocol to use. Values: `MAIL_PROTOCOL_NONE` (0), `MAIL_PROTOCOL_POP` (1), `MAIL_PROTOCOL_IMAP` (2), `MAIL_PROTOCOL_EXCHANGE` (3), `MAIL_PROTOCOL_REST_API` (4), `MAIL_PROTOCOL_IMAP4_PLUGIN` (5). |
| <a id="f-server"></a>`server` | `string` | 2 | The name or address of the mail server. |
| <a id="f-impersonation"></a>`impersonation` | [`Impersonation`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Impersonation/index.md) | 3 | Login information for accessing the mail server. |
| <a id="f-port"></a>`port` | `uint32` | 4 | Mail server port. |
| <a id="f-use_ssl"></a>`use_ssl` | `bool` | 5 | True to use SSL when communicating with the server. |
| <a id="f-connection_timeout"></a>`connection_timeout` | `uint32` | 6 | Timeout for server communication (in seconds). |
| <a id="f-imap_folder"></a>`imap_folder` | `string` | 7 | Mailbox folder name (IMAP4 only). |
| <a id="f-delete_after_import"></a>`delete_after_import` | `bool` | 8 | True to delete the message after importing. |
| <a id="f-remove_attachments_from_server"></a>`remove_attachments_from_server` | `bool` | 9 | True to remove attachments from the original message on the server. |
| <a id="f-include_attachments"></a>`include_attachments` | `bool` | 10 | True to include attachments. |
| <a id="f-only_messages_with_attachments"></a>`only_messages_with_attachments` | `bool` | 11 | True to import only messages that contain attachments. |
| <a id="f-convert_body_to_plain_text"></a>`convert_body_to_plain_text` | `bool` | 12 | True to convert HTML messages to plain text. |
| <a id="f-save_body_to_file"></a>`save_body_to_file` | `bool` | 13 | True to save the message body into a file. |
| <a id="f-embed_attachments"></a>`embed_attachments` | `bool` | 14 | True if the attachments should be saved as a part of the message. |
| <a id="f-storage_format"></a>`storage_format` | [`MailStorageFormat`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.MailStorageFormat/index.md) | 15 | The storage format in which the emails are stored. Values: `MAIL_STORAGE_FORMAT_NONE` (0), `MAIL_STORAGE_FORMAT_TXT` (1), `MAIL_STORAGE_FORMAT_MSG` (2), `MAIL_STORAGE_FORMAT_EML` (3). |
| <a id="f-max_email_age_in_days"></a>`max_email_age_in_days` | `uint32` | 16 | Maximum e-mail age. After this the e-mails will be archived. |
| <a id="f-mail_source_auth_type"></a>`mail_source_auth_type` | [`MailSourceAuthType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.MailSourceAuthType/index.md) | 17 | The authentication method to use. Values: `MAIL_SOURCE_AUTH_TYPE_NONE` (0), `MAIL_SOURCE_AUTH_TYPE_BASIC` (1), `MAIL_SOURCE_AUTH_TYPE_OAUTH2` (2). |
| <a id="f-mail_source_oauth2"></a>`mail_source_oauth2` | [`MailSourceOauth2`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.MailSourceOauth2/index.md) | 18 | OAuth2 specific data. |

<a id="used-in-fields"></a>

## Used in fields

- [`ExtLocUnion.mail_source`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ExtLocUnion/index.md#f-mail_source): Mail source definition.
