# Outgoing Email via Webhooks

A “Webhook” protocol is available to select when creating a new outgoing email server.

## Create a new Outgoing Webhook Server

1. Access **Admin>System Administration>System>Email Settings**

<figure><img src="/files/mO4rRMP623X7Byp5lTil" alt=""><figcaption></figcaption></figure>

2. In the **Outgoing Email** section of the **Email Settings window**, click ***Add***, to create a new server.  To modify an existing configuration, highlight the row and click Open.  Here, you can also test the configuration.

<figure><img src="/files/xihwC0v7LrZ9A6iokos1" alt=""><figcaption></figcaption></figure>

3. Select the '**Webhook'** Protocol from the list.  If the Webhook protocol is not listed, please contact [Alemba Support ](mailto:Support@Alemba.com)for assistance to add the protocol.

<figure><img src="/files/LSClHZymoC0j2n9OhrAl" alt=""><figcaption></figcaption></figure>

4. Configure the Webhook widget:

* Payload URL – This is the webhook endpoint. E.g. the endpoint of the Azure Logic App.
* Secret – This is an optional parameter which will be passed within the webhook request header.  It can be used for extra security at the webhook endpoint.

![](/files/Eg7liuWzvxXYqUNE0078)

5. When emails are sent, they will appear as recent deliveries. You can check whether they were successful or not. You can also redeliver previous deliveries.

![](/files/3HXAEGYMYSKRr3EMGO1X)

## Logic App Configuration

1. Create Logic App with an HTTP Trigger.
2. Paste the following into the Request Body JSON Schema field of the trigger:

```
{
    "properties": {
        "Action": {
            "type": "string"
        },
        "Email": {
            "properties": {
                "Attachments": {
                    "items": {
                        "properties": {
                            "FileData": {
                                "type": "string"
                            },
                            "FileName": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "FileName",
                            "FileData"
                        ],
                        "type": "object"
                    },
                    "type": "array"
                },
                "Bcc": {
                    "type": "string"
                },
                "BodyHtml": {
                    "type": "string"
                },
                "BodyPlainText": {},
                "Cc": {
                    "type": "string"
                },
                "From": {
                    "type": "string"
                },
                "FromAddress": {},
                "FromName": {},
                "Priority": {
                    "type": "string"
                },
                "ReceiptRecipient": {},
                "ReplyTo": {
                    "type": "string"
                },
                "Subject": {
                    "type": "string"
                },
                "To": {
                    "type": "string"
                }
            },
            "type": "object"
        }
    },
    "type": "object"
}
```

3\.  Add an “Initialize variable” action where the variable name is attachment and the type is array:&#x20;

<figure><img src="/files/NGWPYvF0fFhmZYt7AwRk" alt=""><figcaption></figcaption></figure>

4\.  Add a “For each” action which will loop through the Attachments from the trigger and will append the FileData and FileName to the attachment array:

<figure><img src="/files/5OHzKZEpZ7O0dXuG33Yd" alt=""><figcaption></figcaption></figure>

5\.  Add a “Send an email (V2)” action. Configure the connection details to the email server and fill it out as per this screenshot:&#x20;

<figure><img src="/files/A7w1uVIhUUprkDnwiKfj" alt=""><figcaption></figcaption></figure>

6\.  Add a “Response” action to return a 200 status code and a message to say the email had been processed successfully.&#x20;

<figure><img src="/files/UXl5PWIz0VLc9pSPmISw" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.alemba.com/asm-hermes/setup-and-configure-asm/setting-up-your-system/setup-email/setting-up-incoming-and-outgoing-email/outgoing-email-via-web-hooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
