# Send Mail

> `UiPath.MicrosoftOffice365.Activities.Mail.SendMail`

`UiPath.MicrosoftOffice365.Activities.Mail.SendMail`

## Description

Uses the Microsoft Graph [Create message](https://docs.microsoft.com/en-us/graph/api/user-post-messages?view=graph-rest-1.0&tabs=http) and [Send mail](https://docs.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http) APIs to send a message (**Body** and **Subject**) to one or more recipients (**To**, **CC**, and **BCC**). This activity also gives you the option to include one or more attachments (**Attachments**) with your message.

### Scopes

This activity requires the following scopes:

* Mail.ReadWrite AND Mail.Send AND User.Read

OR

* Mail.ReadWrite AND Mail.Send.Shared AND User.Read

OR

* Mail.ReadWrite.Shared AND Mail.Send AND User.Read

OR

* Mail.ReadWrite.Shared AND Mail.Send.Shared AND User.ReadWrite

OR

* Mail.ReadWrite AND Mail.Send AND User.ReadWrite

OR

* Mail.ReadWrite AND Mail.Send.Shared AND User.ReadWrite

OR

* Mail.ReadWrite.Shared AND Mail.Send AND User.ReadWrite

## Project compatibility

Windows - Legacy | Windows

## Configuration

**Properties**

#### **Attachments**

* **Attachments** - A collection containing the paths to the files attached to the email. More details about an email message size limit and file attachment size limit are available [here](https://docs.microsoft.com/en-us/office365/servicedescriptions/exchange-online-service-description/exchange-online-limits#message-limits). Use the **Attach Files** button to open your file explorer, or enter your files using `<in>` arguments.
* **Attachments Collection** - An additional list of files attached to the message.

#### Common

* **DisplayName** - The display name of the activity. This property supports `String` variables and string formatted values.

#### **Email**

* **Body** - The email's message body. If the **Is Body HTML** option is selected, then the body needs to be specified in HTML format. This property supports `String` variables and string formatted values.
* **Subject** - The subject of the email. To send from the current user's email address, leave empty. To send from a different email address, enter an email address that the current user has **SendAs** permissions for. This property supports `String` variables and string formatted values.

#### Input

* **Account** - (Optional) The email address with which to interact. This may include any shared mailbox to which the current user has access rights. If left blank, the current user's account is assumed. This property supports `String` variables and string formatted values.

  :::note
  **Account** field is mandatory for **ApplicationIdAndSecret** and **ApplicationIdAndCertificate** authentication types.
  :::

#### Misc

* **Private** - If selected, the values of variables and arguments are no longer logged at Verbose level. This field supports Boolean values.

#### Options

* **From** - The email address from which the email is sent. If left blank, this defaults to the current user's address. Otherwise, any address that has been assigned **SendAs** rights on the current user's mailbox may be entered. This property supports `String` variables and string formatted values.
* **Importance** - The importance of the mail message. Select one of three options: **Low**, **Normal**, **High**. The default value is **Normal**.
* **Is Body HTML** - If selected, the body of the email is interpreted in HTML format. This field supports Boolean values.
* **Is Draft** - If selected, the message is saved as a draft and not sent. This field supports Boolean values.
* **Reply to** - The email addresses to use when replying. This field supports only `String[]` variables.

#### **Recipients**

* **Bcc** - A comma-separated list of email addresses that you want to be included as **Bcc** recipients. This field supports only `String[]` variables. Required if **Cc** and **To** are empty.
* **Cc** - A comma-separated list of email addresses that you want to be included as **Cc** recipients. This field supports only `String[]` variables. Required if **Bcc** and **To** are empty.
* **To** - A comma-separated list of email addresses that you want to send your mail to. This field supports only `String[]` variables.

  :::note
  To enter one email address, include it between { } and declare it with " " (e.g., *{"user1@uipath.com"}*). To enter multiple email addresses, include all between { }, declare each with " ", and separate each by a comma (e.g., *{"user1@uipath.com","user2@uipath.com"}*).
  :::

## How it works

The following steps and message sequence diagram is an example of how the activity works from design time (i.e., the activity dependencies and input/output properties) to run time.

1. Complete the steps.
2. Add the [Microsoft Office 365 Scope](https://docs.uipath.com/activities/other/latest/productivity/microsoft-office-365-scope) activity to your project.
3. Add the **Send Mail** activity inside the **Microsoft Office 365 Scope** activity.
4. Enter values for the Input and Recipients properties.
5. Run the activity.
   * Your input property values are sent to the [CreateMessage](https://docs.microsoft.com/en-us/graph/api/user-post-messages?view=graph-rest-1.0&tabs=http) and [SendMail](https://docs.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http) APIs.

  ![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/activities-docs-image-183745-56e69701.webp)
