# MailConnectionOptions

> Options used to connect to the mail server.

Options used to connect to the mail server.

**Namespace**: UiPath.Mail.Activities.Api

**Assembly**: UiPath.Mail.Activities.Api (in UiPath.Mail.Activities.Api.dll)

## Constructors

| Constructor | Description | Syntax |
| --- | --- | --- |
| MailConnectionOptions | Initializes a new instance of the `MailConnectionOptions` class. | ``` public class MailConnectionOptions ``` |

## Properties

| Name | Type | Description |
| --- | --- | --- |
| Email | string | The email account used to send or retrieve the email messages. |
| IgnoreCRL | bool | Whether to ignore the Certificate Revocation List validation when connecting. |
| Password | string | The password of the email account used to get the message. If UseOAuth is set to true, the value of this parameter must be an OAuth2 access token. |
| Port | int | The port used to send or retrieve the email messages. |
| SecureConnection | SecureSocketEncryption | The SSL and/or TLS encryption to be used for the connection. |
| Server | string | The email server host to use. |
| Timeout | int | The number of milliseconds to wait before the connection breaks. |
| UseOAuth | bool | Whether to use an OAuth2 access token instead of a password. |

## MailConnectionOptions Methods

These are the methods you can use to configure mail connection options.

### WithEmail

Sets the **Email** property.

**Namespace**: UiPath.Mail.Activities.Api

**Assembly**: UiPath.Mail.Activities.Api (in UiPath.Mail.Activities.Api.dll)

#### `WithEmail(string)`

```
public MailConnectionOptions WithEmail(
	string email
)
```

`email` [String](https://learn.microsoft.com/dotnet/api/system.string) : The email account used to send or retrieve the email messages.

#### Return value

[MailConnectionOptions](https://docs.uipath.com/activities/other/latest/productivity/uipath-mail-activities-api-mailconnectionoptions#mailconnectionoptions)

Returns an updated instance of `MailConnectionOptions`, that you can use to connect to a mail server.

### WithIgnoreCRL

Sets the **IgnoreCRL** property.

**Namespace**: UiPath.Mail.Activities.Api

**Assembly**: UiPath.Mail.Activities.Api (in UiPath.Mail.Activities.Api.dll)

#### `WithIgnoreCRL(boolean)`

```
public MailConnectionOptions WithIgnoreCRL(
	bool ignoreCRL
)
```

`ignoreCRL` [Boolean](https://learn.microsoft.com/dotnet/api/system.boolean) : Specifies whether to ignore the Certificate Revocation List validation when connecting.

#### Return value

[MailConnectionOptions](https://docs.uipath.com/activities/other/latest/productivity/uipath-mail-activities-api-mailconnectionoptions#mailconnectionoptions)

Returns an updated instance of `MailConnectionOptions`, that you can use to connect to a mail server.

### WithOAuth

Sets the **UseOAuth** property.

**Namespace**: UiPath.Mail.Activities.Api

**Assembly**: UiPath.Mail.Activities.Api (in UiPath.Mail.Activities.Api.dll)

#### `WithOAuth(boolean)`

```
public MailConnectionOptions WithOAuth(
	bool useOAuth
)
```

`useOAuth` [Boolean](https://learn.microsoft.com/dotnet/api/system.boolean) : Set this to `True` if you want to use an OAuth2 access token instead of a password.

#### Return value

[MailConnectionOptions](https://docs.uipath.com/activities/other/latest/productivity/uipath-mail-activities-api-mailconnectionoptions#mailconnectionoptions)

Returns an updated instance of `MailConnectionOptions`, that you can use to connect to a mail server.

### WithPassword

Sets the **Password** property.

**Namespace**: UiPath.Mail.Activities.Api

**Assembly**: UiPath.Mail.Activities.Api (in UiPath.Mail.Activities.Api.dll)

#### `WithPassword(string)`

```
public MailConnectionOptions WithPassword(
	string password
)
```

`password` [String](https://learn.microsoft.com/dotnet/api/system.string) : The password of the email account used to get the message. If **UseOAuth** is set to true, the value of this parameter must be an OAuth2 access token.

#### Return value

[MailConnectionOptions](https://docs.uipath.com/activities/other/latest/productivity/uipath-mail-activities-api-mailconnectionoptions#mailconnectionoptions)

Returns an updated instance of `MailConnectionOptions`, that you can use to connect to a mail server.

### WithPort

Sets the **Port** property.

**Namespace**: UiPath.Mail.Activities.Api

**Assembly**: UiPath.Mail.Activities.Api (in UiPath.Mail.Activities.Api.dll)

#### `WithPort(int)`

```
public MailConnectionOptions WithPort(
	int port
)
```

`port` [Int32](https://learn.microsoft.com/dotnet/api/system.int32) : The port used to send or retrieve the email messages.

#### Return value

[MailConnectionOptions](https://docs.uipath.com/activities/other/latest/productivity/uipath-mail-activities-api-mailconnectionoptions#mailconnectionoptions)

Returns an updated instance of `MailConnectionOptions`, that you can use to connect to a mail server.

### WithSecureConnction

Sets the **SecureConnection** property.

**Namespace**: UiPath.Mail.Activities.Api

**Assembly**: UiPath.Mail.Activities.Api (in UiPath.Mail.Activities.Api.dll)

#### `WithSecureConnection(SecureSocketEncryption)`

```
public MailConnectionOptions WithSecureConnection(
	SecureSocketEncryption secureConnection
)
```

`secureConnection` `SecureSocketEncryption` : The SSL and/or TLS encryption to be used for the connection.

#### Return value

[MailConnectionOptions](https://docs.uipath.com/activities/other/latest/productivity/uipath-mail-activities-api-mailconnectionoptions#mailconnectionoptions)

Returns an updated instance of `MailConnectionOptions`, that you can use to connect to a mail server.

### WithServer

Sets the **Server** property.

**Namespace**: UiPath.Mail.Activities.Api

**Assembly**: UiPath.Mail.Activities.Api (in UiPath.Mail.Activities.Api.dll)

#### `WithServer(string)`

```
public MailConnectionOptions WithServer(
	string server
)
```

`server` [String](https://learn.microsoft.com/dotnet/api/system.string) : The email server host to use.

#### Return value

[MailConnectionOptions](https://docs.uipath.com/activities/other/latest/productivity/uipath-mail-activities-api-mailconnectionoptions#mailconnectionoptions)

Returns an updated instance of `MailConnectionOptions`, that you can use to connect to a mail server.

### WithTimeout

Sets the **Timeout** property.

**Namespace**: UiPath.Mail.Activities.Api

**Assembly**: UiPath.Mail.Activities.Api (in UiPath.Mail.Activities.Api.dll)

#### `WithTimeout(int)`

```
public MailConnectionOptions WithTimeout(
	int timeout
)
```

`timeout` [Int32](https://learn.microsoft.com/dotnet/api/system.int32) : The number of milliseconds to wait before the connection breaks.

#### Return value

[MailConnectionOptions](https://docs.uipath.com/activities/other/latest/productivity/uipath-mail-activities-api-mailconnectionoptions#mailconnectionoptions)

Returns an updated instance of `MailConnectionOptions`, that you can use to connect to a mail server.
