---
title: Sending transactional mails
slug: campaign/docs/7kGZ-sending-transactional-mails
docTags: 
createdAt: 2026-07-20T15:45:01.299Z
---

:::hint{type="info"}
**Note**

This topic is for administrators and developers with administration access rights in Microsoft Dynamics.
:::

This topic describes how to send transaction mails in Optimizely Campaign from Microsoft Dynamics CRM using a workflow in CRM. After sending, [response data](docId\:t68D2sjgQkr6u5obvIh0A) (opens, clicks) are automatically transferred into CRM.

## Prerequisites

- **Configuration** of the integration completed, see [Configuration](docId\:amcyrSqPEVelSryjVZUFT).
- **Campaign mailing** prepared in Optimizely Campaign.
- The **ID of the campaign mailing** to be sent. You can find the ID under **Transactional mails** in Optimizely Campaign. Select the column **ID** in the drop-down list to the right.
- The [authorization code](https://world.optimizely.com/documentation/developer-guides/campaign/http-api/security/) of the recipient list used by the transactional mailing.

## [7kGZ-sending-transactional-mails.mdx](docId\:HDpA7A20mzY-GbxAvsyIN)Configuring transactional mailings and workflows

Before sending a transactional mailing from Optimizely Campaign, you need to configure the transactional mailing in Microsoft Dynamics CRM. You can send these mailings to contacts, accounts or leads even without advertising consent. You also need to define a workflow to trigger the transactional mailing.

### Configuring the transactional mailing

1. Open Microsoft Dynamics CRM and select **Settings** > **Configurations**.

   ![Image: Configurations](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/sT1-_z74nqSXMQibOd5bQ-20260720-145401.png "Image: Configurations")
2. Click **New**.
3. Enter a name for the configuration.
4. In the **Value** field, define the configuration using an XML format.The fields `<authCode>` and `<bmMailingID>` are mandatory.
   For `<authCode>`, enter the **authorization code** for the transactional mailing's recipient list. For `<bmMailingId>`, enter the **mailing ID** of the transactional mailing.
   Other fields can be optionally linked, as long as the information is available in CRM.

```html
<root><authCode>authorization.Code</authCode><bmMailingId>mailing.ID</bmMailingId><firstname>object.firstname</firstname><lastname>object.lastname</lastname><salutation>object.salutation</salutation></root>
```

:::Paragraph{indent="1"}
When sending from another entity except *contact*, *lead* or *account*, a lookup references to the connected `bmRecipientId`. Furthermore, data fields in *contact*, *lead* or *account* are integrated via lookups.
:::

```html
<root><authCode> Authorisierungs-Code </authCode><bmMailingId> Mailing-ID </bmMailingId><bmRecipientId>object.new_exampleentityfor.emailaddress1</bmRecipientId><dynamicsId>object.new_exampleentityfor.contactid</dynamicsId><first_name>object.new_exampleentityfor.firstname</first_name><last_name>object.new_exampleentityfor.lastname</last_name></root>
```

:::Paragraph{indent="1"}
You can find the name of the lookup element that is inserted between the `object` and the field name (for example, `contactid`) in the **Fields** overview. Search for the name of the field in which the lookup for *contact*, *lead*, or *account* is performed. In the example, the name is *new\_exampleentityfor*.
:::

::Image[]{src="https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/VuNM51kUpSksP9AiHMH2q-20260720-145401.png" size="100" caption="Image: Lookup in Fields" alt="Image: Lookup in Fields" isUploading="false" showCaption="true" indent="2"}

5. Click **Save & Close**.

   ![Image: Save & Close](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/5dh8TmYbUBEgVpwW1mS32-20260720-145401.png "Image: Save & Close")

:::hint{type="info"}
**Note**

The configuration can be updated and saved if needed.
:::

### Configuring the workflow

1. Open Microsoft Dynamics CRM and select **Settings** > **Processes**.

   ![Image: Processes](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/cvb29VdYSj6jT6byAvOWQ-20260720-145401.png "Image: Processes")
2. Click **New**.
3. Enter a name in **Process name**.
4. Under **Category**, select **Workflow**.
5. As **Entity**, select **Contact**, **Lead** or **Company**.
6. Keep the selection **Run this workflow in the background**.
7. Select **New blank process**, if you are not using an existing workflow as template,
8. Click **OK**.

   ![Image: Create process dialog box](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/VcmdgR9C9w_BIfxncEePK-20260720-145401.png "Image: Create process dialog box")
9. Under **Activate As** define if the workflow is to be created as process or as template.
10. Under **Available to Run**, select the dependencies of the process. For manual start, select **As an on-demand process**.
11. Under **Workflow Job Retention**, define if the workflows should be automatically deleted after completion.
12. Under **Options for Automatic Processes**, define who can start the process.
13. Under **Start when**, define which action should trigger automatic dispatch. If nothing is selected, the dispatch is started manually in CRM.
14. Select **Add Step** > **Episerver Campaign** > **Send Transaction Mail**.

    ![Image: Send Transaction Mail](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/TnRI2PSUlter5eb1GK4Gt-20260720-145401.png "Image: Send Transaction Mail")
15. Click **Set Properties**.
16. In the **Value** column, search for and select the previously created configuration.

    ![Image: Locate configuration](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/XvMhEjbqFymUswu8oMaiT-20260720-145401.png "Image: Locate configuration")
17. Click **Save and Close.**

## Checking return values of the process

You should add error handling steps, configuring how the process should handle different return values of incorrectly sent transactional mails. Transactional mailings are sent using the [sendtransactionmail](https://world.optimizely.com/documentation/developer-guides/campaign/http-api/services-and-operations/sendtransactionmail/) operation of the HTTP API. Here is an example for canceling an unsuccessful process.

:::Paragraph{listStyleType="decimal" indent="2"}
In the **Process** window in Microsoft Dynamics CRM, click **Add Step** > **Check Condition**.
:::

:::Paragraph{listStyleType="decimal" listStart="2" indent="2"}
Click **\<condition> (click to configure)**.
:::

:::Paragraph{listStyleType="decimal" listStart="3" indent="2"}
Click **Select**.
:::

:::Paragraph{listStyleType="decimal" listStart="4" indent="2"}
Click **Send Transaction Mail**.
:::

:::Paragraph{listStyleType="decimal" listStart="5" indent="2"}
Click **Service Response** in the second drop-down list.
:::

:::Paragraph{listStyleType="decimal" listStart="6" indent="2"}
Click **Does Not Begin With** in the third drop-down list.
:::

:::Paragraph{listStyleType="decimal" listStart="7" indent="2"}
Click **Enter value** and enter the return value *enqueued*.
:::

:::Paragraph{listStyleType="decimal" listStart="8" indent="2"}
Click **Save and Close**.
:::

::Image[]{src="https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/_H3qv0z7-aRx14li9TJdZ-20260720-145401.png" size="100" caption="Image: Check conditions" alt="Image: Check conditions" isUploading="false" showCaption="true" indent="3"}

:::Paragraph{listStyleType="decimal" listStart="9" indent="2"}
Click **Select this row and click Add Step**.
:::

:::Paragraph{listStyleType="decimal" listStart="10" indent="2"}
Select **Add Step** > **Stop Workflow**.
:::

:::Paragraph{listStyleType="decimal" listStart="11" indent="2"}
Select **Canceled** in the status drop-down list.
:::

![Image: Stop workflow](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/4fAApaq_buv8ZuKSnYYm4-20260720-145401.png "Image: Stop workflow")

:::Paragraph{listStyleType="decimal" indent="2"}
Click **Set Properties**.
:::

:::Paragraph{listStyleType="decimal" listStart="2" indent="2"}
Click in the **Value** column.
:::

:::Paragraph{listStyleType="decimal" listStart="3" indent="2"}
In the drop-down list, select **Look for:**> **Send Transaction Mail**.
:::

:::Paragraph{listStyleType="decimal" listStart="4" indent="2"}
In the drop-down list, select **Service Response**.
:::

:::Paragraph{listStyleType="decimal" listStart="5" indent="2"}
Click **Add**.
:::

:::Paragraph{listStyleType="decimal" listStart="6" indent="2"}
Click **OK**.
:::

:::Paragraph{listStyleType="decimal" listStart="7" indent="2"}
Click **Save and Close**.
:::

::Image[]{src="https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/Y0wbAzADyK_nid9j47CAo-20260720-145401.png" size="100" caption="Image: Service Response" alt="Image: Service Response" isUploading="false" showCaption="true" indent="3"}

:::Paragraph{listStyleType="decimal" listStart="8" indent="2"}
Under **Process** in the menu bar, click **Convert to a real-time workflow**.
:::

:::Paragraph{listStyleType="decimal" listStart="9" indent="2"}
Click **Activate**, and **Activate** in the **Process Activate Confirmation** dialog box.
:::

:::Paragraph{listStyleType="decimal" listStart="10" indent="2"}
In the **Process** window, click **Close**.
:::

![Image: Save and Close](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/iWW88Uhd_I4hISiHY1fB_-20260720-145401.png "Image: Save and Close")

## Send out transactional mailing

The workflow is now fully created, activated and starts according to the preconfigured action or may be triggered manually. A transaction mailing is started manually from the entity specified in the process.

1. Select **Run Workflow** in the entity.

   ![Image: Run workflow](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/v3K0oTNlsSIs6_rWGXEbm-20260720-145401.png "Image: Run workflow")
2. The **Lookup Record** dialog box opens. Select the workflow of the transaction mailing and click **Add**.

   ![Image: Lookup Record dialog box](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/rmTVQsVRaVoM3-E61OL2Q-20260720-145401.png "Image: Lookup Record dialog box")
3. The dialog box **Confirm Application of Workflow** opens. Click **OK**.
