> For the complete documentation index, see [llms.txt](https://docs.frends.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frends.com/tasks/tasks/as2/sendmessage.md).

# SendMessage

As2 SendMessage task sends a message to an AS2 server using the provided parameters

Task version: 1.1.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.As2/tree/main/Frends.As2.SendMessage>

## Task Parameters

{% tabs %}
{% tab title="Input" %}

| Name                           | Description                                                                                                                                                                       |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SenderAs2Id : `String`         | <p>Id of the company that will send the message.</p><p><br>Default: <code>-</code><br>Example: <code>MyCompany</code></p>                                                         |
| ReceiverAs2Id : `String`       | <p>Id of the company that will receive the message.</p><p><br>Default: <code>-</code><br>Example: <code>YourCompany</code></p>                                                    |
| Subject : `String`             | <p>Subject of the AS2 message.</p><p><br>Default: <code>-</code><br>Example: <code>Subject of the message</code></p>                                                              |
| MessageFilePath : `String`     | <p>Path to the file that will be sent in the message.</p><p><br>Default: <code>-</code><br>Example: <code>C:\Document\message.txt</code></p>                                      |
| AdditionalHeaders : `Header[]` | <p>Optional additional HTTP headers to send with the AS2 message.</p><p><br>Default: <code>-</code><br>Example: <code>\[{ "Name": "X-ApiKey", "Value": "my-api-key" }]</code></p> |
| {% endtab %}                   |                                                                                                                                                                                   |

{% tab title="Connection" %}

| Name                                   | Description                                                                                                                                                                  |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| As2EndpointUrl : `String`              | <p>Connection string to AS2 server</p><p><br>Default: <code>-</code><br>Example: <code><https://as2.example.com/as2></code></p>                                              |
| SignMessage : `Boolean`                | <p>Defines whether to sign the message.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                              |
| EncryptMessage : `Boolean`             | <p>Defines whether to encrypt the message.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                           |
| 🗝SenderCertificatePassword : `String` | <p>Password for the sender certificate.</p><p><br>Default: <code>-</code><br>Example: <code>mySecurePassword123</code></p>                                                   |
| SenderCertificatePath : `String`       | <p>Path to the sender certificate file in .pfx format.</p><p><br>Default: <code>-</code><br>Example: <code>C:\Document\sender\_cert.pfx</code></p>                           |
| ReceiverCertificatePath : `String`     | <p>Path to the receiver certificate file in .pfx format.</p><p><br>Default: <code>-</code><br>Example: <code>C:\Document\receiver\_cert.pfx</code></p>                       |
| MdnReceiver : `String`                 | <p>URL or email where to send the MDN (Message Disposition Notification).</p><p><br>Default: <code>-</code><br>Example: <code><user@example.com></code></p>                  |
| ContentTypeHeader : `String`           | <p>Specify content type header for the message if it's neither encrypted nor signed.</p><p><br>Default: <code>text/plain</code><br>Example: <code>application/zip</code></p> |
| {% endtab %}                           |                                                                                                                                                                              |

{% tab title="Options" %}

| Name                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MdnMode : `MdnMode`              | <p>Specifies whether to request synchronous or asynchronous MDN</p><p>Possible values:</p><ul><li><code>Sync</code>: Synchronous MDN mode. The sender waits for the MDN immediately after sending the message.</li><li><code>Async</code>: Asynchronous MDN mode. The sender requests the recipient to post the MDN to a separate endpoint,</li></ul><p>allowing the send operation to complete without waiting for the MDN.</p><p><br>Default: <code>Sync</code><br>Example: <code>Sync</code></p> |
| AsyncMdnUrl : `String`           | <p>URL where async MDN should be sent (required when MdnMode is Async)</p><p><br>Default: <code>-</code><br>Example: <code><https://mycompany.com/api/as2/mdn-receiver></code></p>                                                                                                                                                                                                                                                                                                                  |
| ThrowErrorOnFailure : `Boolean`  | <p>Whether to throw an error on failure.</p><p><br>Default: <code>True</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                    |
| ErrorMessageOnFailure : `String` | <p>Overrides the error message on failure.</p><p><br>Default: <code>-</code><br>Example: <code>Custom error message</code></p>                                                                                                                                                                                                                                                                                                                                                                      |
| {% endtab %}                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| {% endtabs %}                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

## Task Result

| Name                               | Description                                                                                                                                                                                                          |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean`                | <p>Indicates if the task completed successfully.<br>Example: <code>true</code></p>                                                                                                                                   |
| PartnerResponse : `String`         | <p>The transport/MDN response from the AS2 partner: - Sync mode: full multipart/signed MDN content - Async mode: the immediate response from the POST (e.g., "200 OK")<br>Example: <code>200 OK</code></p>           |
| MessageId : `String`               | <p>ID of a sent message.<br>Example: <code>123</code></p>                                                                                                                                                            |
| MdnStatus : `String`               | <p>Status of the MDN response.<br>Example: <code>ReceivedValid</code></p>                                                                                                                                            |
| MdnMessage : `String`              | <p>Human-readable message included in the MDN.<br>Example: <code>The message was successfully received and processed.</code></p>                                                                                     |
| MdnIntegrityCheck : `String`       | <p>Message Integrity Check (MIC) value reported in the MDN.<br>Example: <code>"7v7F+fQbH4lD8bKGJTbXzWWcUlI=, sha1"</code></p>                                                                                        |
| IsMdnPending : `Boolean`           | <p>Indicates whether the MDN delivery is pending (true for async MDN mode, false for sync MDN mode). When true, the MDN will be delivered separately to the AsyncMdnUrl endpoint.<br>Example: <code>false</code></p> |
| Error : `Error`                    | <p>Error that occurred during task execution.<br>Example: <code>object { string Message, object { Exception Exception } AdditionalInfo }</code></p>                                                                  |
| Error.Message : `String`           | <p>Summary of the error.<br>Example: <code>Unable to join strings.</code></p>                                                                                                                                        |
| Error.AdditionalInfo : `Exception` | <p>Additional information about the error.<br>Example: <code>object { Exception Exception }</code></p>                                                                                                               |

## Task Changelog

Changelog for Task Frends.As2.SendMessage.

### \[1.1.0] - 2026-07-21

#### Changed

* Added missing documentation examples to Header properties (Name and Value).
* Updated copyright field in project file to match compliance requirements.

### \[1.0.0] - 2025-09-11

#### Changed

* Initial implementation


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.frends.com/tasks/tasks/as2/sendmessage.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
