> 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/mllp/send.md).

# Send

Task version: 1.6.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.Mllp/tree/main/Frends.Mllp.Send>

## Task Parameters

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

| Name                  | Description                                                    |                           |            |            |              |              |                |   |         |          |   |            |     |                     |   |   |                     |   |          |   |          |                                      |          |            |            |              |              |                |   |         |          |   |            |     |                     |   |   |                     |   |          |   |          |              |
| --------------------- | -------------------------------------------------------------- | ------------------------- | ---------- | ---------- | ------------ | ------------ | -------------- | - | ------- | -------- | - | ---------- | --- | ------------------- | - | - | ------------------- | - | -------- | - | -------- | ------------------------------------ | -------- | ---------- | ---------- | ------------ | ------------ | -------------- | - | ------- | -------- | - | ---------- | --- | ------------------- | - | - | ------------------- | - | -------- | - | -------- | ------------ |
| Hl7Message : `String` | <p>HL7 message to send over MLLP.</p><p><br>Default: <code>MSH | ^</code><del><code>\&amp; | SendingApp | SendingFac | ReceivingApp | ReceivingFac | 20250101010101 |   | ADT^A01 | MSG00001 | P | 2.5.1\rEVN | A01 | 20250101010101\rPID | 1 |   | 12345^^^Hospital^MR |   | Doe^John |   | 19800101 | M</code></del><br>Example: <code>MSH | ^\&#x26; | SendingApp | SendingFac | ReceivingApp | ReceivingFac | 20250101010101 |   | ADT^A01 | MSG00001 | P | 2.5.1\rEVN | A01 | 20250101010101\rPID | 1 |   | 12345^^^Hospital^MR |   | Doe^John |   | 19800101 | M</code></p> |
| {% endtab %}          |                                                                |                           |            |            |              |              |                |   |         |          |   |            |     |                     |   |   |                     |   |          |   |          |                                      |          |            |            |              |              |                |   |         |          |   |            |     |                     |   |   |                     |   |          |   |          |              |

{% tab title="Connection" %}

| Name                                      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Host : `String`                           | <p>Hostname or IP address of the MLLP listener.</p><p><br>Default: <code>127.0.0.1</code><br>Example: <code>127.0.0.1</code></p>                                                                                                                                                                                                                                                                                                                                                                                        |
| Port : `Int32`                            | <p>TCP port of the MLLP listener.</p><p><br>Default: <code>2575</code><br>Example: <code>2575</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                |
| TlsMode : `TlsMode`                       | <p>The TLS encryption mode to use for the connection.</p><p>Possible values:</p><ul><li><code>None</code>: No encryption. Data is sent in plain text (standard TCP).</li><li><code>Mtls</code>: Mutual TLS. Both client and server must provide valid certificates to establish a secure, encrypted connection.</li></ul><p><br>Default: <code>None</code><br>Example: <code>TlsMode.None</code></p>                                                                                                                    |
| ClientCertPath : `String`                 | <p>Path to the client certificate file (PFX or P12 format).</p><p>Required only for MTLS mode.</p><p><br>Default: <code>-</code><br>Example: <code>C:\certs\client.pfx</code></p>                                                                                                                                                                                                                                                                                                                                       |
| 🗝ClientCertPassword : `String`           | <p>Password for the client certificate.</p><p><br>Default: <code>-</code><br>Example: <code>MyStrongPassword123</code></p>                                                                                                                                                                                                                                                                                                                                                                                              |
| ConnectTimeoutSeconds : `Int32`           | <p>Connection timeout in seconds when opening the socket.</p><p><br>Default: <code>30</code><br>Example: <code>30</code></p>                                                                                                                                                                                                                                                                                                                                                                                            |
| ReadTimeoutSeconds : `Int32`              | <p>Read timeout in seconds when waiting for an acknowledgement.</p><p><br>Default: <code>30</code><br>Example: <code>30</code></p>                                                                                                                                                                                                                                                                                                                                                                                      |
| IgnoreServerCertificateErrors : `Boolean` | <p>If enabled, the task will ignore server-side certificate validation errors.</p><p>(e.g., self-signed certificates or hostname mismatches).</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                  |
| ServerCertificateThumbprints : `String[]` | <p>Expected server certificate thumbprint(s) for validation.</p><p>Only used when IgnoreServerCertificateErrors is false.</p><p>Used in MTLS mode for certificate pinning.</p><p><br>Default: <code>-</code><br>Example: <code>E5FA62B8B5F3B0B2B3B4B5B6B7B8B9B0B1B2B3B4</code></p>                                                                                                                                                                                                                                      |
| Encoding : `FileEncoding`                 | <p>Encoding used to encode the HL7 message before sending.</p><p>Possible values:</p><ul><li><code>UTF8</code>: UTF-8 encoding.</li><li><code>Default</code>: The system default encoding.</li><li><code>ASCII</code>: ASCII encoding.</li><li><code>Unicode</code>: Unicode (UTF-16) encoding.</li><li><code>Windows1252</code>: Windows-1252 encoding.</li><li><code>Other</code>: A custom encoding specified as a string.</li></ul><p><br>Default: <code>UTF8</code><br>Example: <code>FileEncoding.UTF8</code></p> |
| EncodingInString : `String`               | <p>Custom encoding name, used when Encoding is set to Other.</p><p><br>Default: <code>-</code><br>Example: <code>iso-8859-1</code></p>                                                                                                                                                                                                                                                                                                                                                                                  |
| {% endtab %}                              |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

{% tab title="Options" %}

| Name                                       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ValidateWithNhapi : `Boolean`              | <p>Validate and normalize the HL7 payload using NHapi before sending.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                          |
| ExpectAcknowledgement : `Boolean`          | <p>Read the acknowledgement from the listener after sending the message.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                       |
| StartBlockByte : `Byte`                    | <p>The MLLP start-block framing byte (decimal). Default is 11 (0x0B, vertical tab).</p><p><br>Default: <code>11</code><br>Example: <code>11</code></p>                                                                                                                                                                                                                                                                                                                                |
| EndBlockByte : `Byte`                      | <p>The MLLP end-block framing byte (decimal). Default is 28 (0x1C, file separator).</p><p><br>Default: <code>28</code><br>Example: <code>28</code></p>                                                                                                                                                                                                                                                                                                                                |
| CarriageReturnByte : `Byte`                | <p>The MLLP end-of-block trailer byte (decimal). Default is 13 (0x0D, carriage return).</p><p><br>Default: <code>13</code><br>Example: <code>13</code></p>                                                                                                                                                                                                                                                                                                                            |
| MaxMessageSize : `Int32`                   | <p>Maximum message size in bytes. Messages exceeding this limit will not be sent. 0 means unlimited.</p><p><br>Default: <code>0</code><br>Example: <code>1048576</code></p>                                                                                                                                                                                                                                                                                                           |
| AcceptableAckCodes : `AcceptableAckCodes`  | <p>Determines which ACK codes are considered a successful send.</p><p>Possible values:</p><ul><li><code>All</code>: AA, CA, AE, CE, AR, CR are all treated as success.</li><li><code>Success</code>: Only AA, CA are treated as success.</li><li><code>Error</code>: AA, CA, AE, CE are treated as success.</li><li><code>Reject</code>: AA, CA, AR, CR are treated as success.</li></ul><p><br>Default: <code>Success</code><br>Example: <code>AcceptableAckCodes.Success</code></p> |
| KeepConnectionAlive : `Boolean`            | <p>Keep the TCP connection alive and reuse it across multiple executions.</p><p>When enabled, the connection is cached for the duration of the sliding expiration window.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                    |
| ConnectionCacheExpirationMinutes : `Int32` | <p>How long (in minutes) an idle cached connection is kept alive before being closed.</p><p>Only used when KeepConnectionAlive is true.</p><p><br>Default: <code>5</code><br>Example: <code>5</code></p>                                                                                                                                                                                                                                                                              |
| RetryCount : `Int32`                       | <p>Number of times to retry sending the message if an error occurs. 0 means no retries (single attempt).</p><p><br>Default: <code>0</code><br>Example: <code>3</code></p>                                                                                                                                                                                                                                                                                                             |
| RetryIntervalSeconds : `Int32`             | <p>Delay in seconds between retry attempts. Only used when RetryCount is greater than 0.</p><p><br>Default: <code>5</code><br>Example: <code>5</code></p>                                                                                                                                                                                                                                                                                                                             |
| EnableLogging : `Boolean`                  | <p>Enable message processing logging to file.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                 |
| LogFilePath : `String`                     | <p>File path for logging message send events. If not specified, logs to a default location.</p><p><br>Default: <code>-</code><br>Example: <code>C:\Logs\mllp-messages.log</code></p>                                                                                                                                                                                                                                                                                                  |
| LogMessageContent : `Boolean`              | <p>Include full message content in logs. If false, only logs message metadata and status.</p><p><br>Default: <code>False</code><br>Example: <code>false</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>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |      |                |
| Output : `String`                  | <p>Acknowledgement returned by the MLLP listener.<br>Example: <code>MSH                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | ^\~& | ...</code></p> |
| AckResultType : `AckResultType`    | <p>Classification of the received acknowledgement (Accept, Error, Reject, Invalid, or NotApplicable for one-way sends). Possible values: - <code>Accept</code>: Acknowledgement code was AA or CA (Application/Commit Accept). - <code>Error</code>: Acknowledgement code was AE or CE (Application/Commit Error). - <code>Reject</code>: Acknowledgement code was AR or CR (Application/Commit Reject). - <code>Invalid</code>: Acknowledgement could not be parsed, or MSA-1 contained an unrecognized code. - <code>NotApplicable</code>: No acknowledgement was expected or received (one-way send).<br>Example: <code>AckResultType.Accept</code></p> |      |                |
| AckCodeValue : `String`            | <p>The raw acknowledgement code extracted from MSA-1 (e.g. AA, AE, AR). Null if no ACK was received or parsing failed.<br>Example: <code>AA</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |      |                |
| AckErrorDescription : `String`     | <p>Error or status description extracted from MSA-3, present on negative acknowledgements.<br>Example: <code>Required field PID-3 is missing</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |      |                |
| Error : `Error`                    | <p>Error that occurred during task execution.<br>Example: <code>object { string Message, Exception AdditionalInfo }</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |      |                |
| Error.Message : `String`           | <p>Summary of the error.<br>Example: <code>Unable to send HL7 message.</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |      |                |
| Error.AdditionalInfo : `Exception` | <p>Additional information about the error.<br>Example: <code>object { Exception AdditionalInfo }</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |      |                |

## Task Changelog

Changelog for Task Frends.Mllp.Send.

### \[1.6.0] - 2026-08-06

#### Changed

* Updated copyright notice to comply with Frends standard requirements.

### \[1.5.0] - 2026-06-22

#### Added

* `Options.MaxMessageSize` to reject outgoing messages exceeding a configurable size limit (0 = unlimited), logged as MESSAGE REJECTED when enabled
* `Options.KeepConnectionAlive` and `Options.ConnectionCacheExpirationMinutes` to reuse a single MLLP connection across multiple Send executions instead of opening a new connection each time
* `Options.RetryCount` and `Options.RetryIntervalSeconds` to automatically retry sending on failure, with a configurable delay between attempts
* ACK parsing and classification (AckResultType: Accept, Error, Reject, Invalid, NotApplicable) based on MSA-1/MSA-3, returned via Result.AckResultType, Result.AckCodeValue, and Result.AckErrorDescription
* `Options.AcceptableAckCodes` to configure which ACK classifications are treated as a successful send (All, Success, Error, Reject)
* `Options.EnableLogging`, `Options.LogFilePath`, and `Options.LogMessageContent` to log message send events (sent, success, failure, rejected, retry, connection dropped, ACK failure) to file

### \[1.4.0] - 2026-05-06

#### Added

* `Options.StartBlockByte`, `Options.EndBlockByte`, and `Options.CarriageReturnByte` to allow configuring MLLP framing bytes (defaults: 11, 28, 13)

### \[1.3.0] - 2026-04-17

#### Added

* `Connection.ServerCertificateThumbprints` to allow pinning the expected server certificate in MTLS mode when `IgnoreServerCertificateErrors` is `false`

### \[1.2.0] - 2026-04-13

#### Changed

* `Connection.Encoding` is now selectable and can be set custom by user

### \[1.1.0] - 2026-03-12

#### Added

* `Connection.Encoding` parameter to allow configuring the character encoding used when sending HL7 messages (default: `UTF-8`)

### \[1.0.0] - 2026-02-05

#### Added

* 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 dynamically by asking a question.

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

```
GET https://docs.frends.com/tasks/tasks/mllp/send.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
