# SendEmail

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

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

{% tabs %}
{% tab title="Parameter: Connection" %}

| Name                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AuthenticationProvider : `AuthenticationProviders` | <p>Specifies the authentication provider to use.</p><p>Possible values:</p><ul><li><code>ClientCredentialsCertificate</code>:</li></ul><p>Specifies the authentication provider to use.</p><ul><li><code>ClientCredentialsSecret</code>:</li></ul><p>Specifies the authentication provider to use.</p><ul><li><code>UsernamePassword</code>:</li></ul><p>Specifies the authentication provider to use.</p><p><br>Default: <code>2</code><br>Example: <code>-</code></p> |
| X509CertificateFilePath : `String`                 | <p>The path to a file that contains both the client certificate and private key.</p><p><br>Default: <code>-</code><br>Example: <code>c:\temp\mycert.pfx</code></p>                                                                                                                                                                                                                                                                                                      |
| ClientSecret : `String`                            | <p>The secret key of the client application.</p><p><br>Default: <code>-</code><br>Example: <code>Y2lzY29zeXN0ZW1zOmMxc2Nv</code></p>                                                                                                                                                                                                                                                                                                                                    |
| Username : `String`                                | <p>The username of the user.</p><p><br>Default: <code>-</code><br>Example: <code><username@example.com></code></p>                                                                                                                                                                                                                                                                                                                                                      |
| 🗝Password : `String`                              | <p>The password of the user.</p><p><br>Default: <code>-</code><br>Example: <code>password123</code></p>                                                                                                                                                                                                                                                                                                                                                                 |
| ClientId : `String`                                | <p>The app ID for fetching an access token.</p><p>This is the unique identifier for your application.</p><p><br>Default: <code>-</code><br>Example: <code>4a1aa1d9-c16a-40a2-bd7d-2bd40babe4ff</code></p>                                                                                                                                                                                                                                                               |
| TenantId : `String`                                | <p>The tenant ID for fetching an access token.</p><p>This is the unique identifier of your Azure AD tenant.</p><p><br>Default: <code>-</code><br>Example: <code>9188040d-6c67-4c5b-b112-36a304b66dad</code></p>                                                                                                                                                                                                                                                         |
| {% endtab %}                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

{% tab title="Parameter: Input" %}

| Name                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| From : `String`                 | <p>Sender email address.</p><p>This is the email address that will appear in the "From" field of the email.</p><p><br>Default: <code>-</code><br>Example: <code><sender@example.com></code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| To : `String`                   | <p>Recipient addresses separated by ',' or ';'.</p><p>These are the main recipients of the email.</p><p><br>Default: <code>-</code><br>Example: <code><recipient1@example.com>, <recipient2@example.com></code></p>                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Cc : `String`                   | <p>Cc recipient addresses separated by ',' or ';'.</p><p>These recipients will receive a copy of the email.</p><p><br>Default: <code>-</code><br>Example: <code><cc1@example.com>, <cc2@example.com></code></p>                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Bcc : `String`                  | <p>Bcc recipient addresses separated by ',' or ';'.</p><p>These recipients will receive a copy of the email, but other recipients will not see their email addresses.</p><p><br>Default: <code>-</code><br>Example: <code><bcc1@example.com>, <bcc2@example.com></code></p>                                                                                                                                                                                                                                                                                                                                                                 |
| Subject : `String`              | <p>Email message's subject.</p><p>This is the main topic or title of the email.</p><p><br>Default: <code>-</code><br>Example: <code>Meeting Reminder</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Message : `String`              | <p>Body of the message.</p><p>This is the main content of the email.</p><p><br>Default: <code>-</code><br>Example: <code>Don't forget about our meeting tomorrow at 10am.</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| IsMessageHtml : `Boolean`       | <p>Set this true if the message is HTML.</p><p>This allows you to send emails with HTML formatting.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Importance : `ImportanceLevels` | <p>Importance level.</p><p>This sets the importance level of the email (e.g., Low, Normal, High).</p><p>Possible values:</p><ul><li><code>Low</code>:</li></ul><p>Importance level.</p><p>This sets the importance level of the email (e.g., Low, Normal, High).</p><ul><li><code>Normal</code>:</li></ul><p>Importance level.</p><p>This sets the importance level of the email (e.g., Low, Normal, High).</p><ul><li><code>High</code>:</li></ul><p>Importance level.</p><p>This sets the importance level of the email (e.g., Low, Normal, High).</p><p><br>Default: <code>1</code><br>Example: <code>ImportanceLevels.Normal</code></p> |
| SaveToSentItems : `Boolean`     | <p>Indicates whether to save the message in Sent Items.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Attachments : `Attachments[]`   | <p>Email attachments.</p><p><br>Default: <code>-</code><br>Example: <code>{ AttachmentTypes.FileAttachment, C:\temp\temp.txt, </code><em><code>.</code></em><code> }, { AttachmentTypes.AttachmentFromString, temp.txt, "This is temp file." }</code></p>                                                                                                                                                                                                                                                                                                                                                                                   |
| {% endtab %}                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

{% tab title="Parameter: Options" %}

| Name                                           | Description                                                                                                                                                                    |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ThrowExceptionOnFailure : `Boolean`            | <p>Gets or sets a value indicating whether an error should stop the task and throw an exception.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>        |
| ThrowExceptionIfAttachmentNotFound : `Boolean` | <p>Gets or sets a value indicating whether an exception should be thrown if no files match the given path.</p><p><br>Default: <code>-</code><br>Example: <code>true</code></p> |
| {% endtab %}                                   |                                                                                                                                                                                |

{% tab title="Result: Result" %}

| Name                | Description                                                                                                                                                                           |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean` | <p>Gets a value indicating whether the task was executed successfully.<br>Example: <code>true</code></p>                                                                              |
| Data : `String`     | <p>Gets the result of the task. Contains exception message if exception was thrown and Options.ThrowExceptionOnFailure = false.<br>Example: <code>Email sent successfully.</code></p> |
| {% endtab %}        |                                                                                                                                                                                       |

{% tab title="Changelog" %}

## Changelog

### \[1.1.0] - 2024-08-22

#### Changed

* Updated the MimeKit and Azure.Identity libraries to their latest versions.

### \[1.0.0] - 2023-11-29

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
