Skip to main content
Skip table of contents

MIME Multipart Reader

The adapter reads body parts of a multipart message and outputs one or all body parts as text or as a Base64-encoded XML document with header information.

Properties

Operation

Determines which operation the adapter executes

Possible values:

  • GetDocument: Reads a specific part of the multipart message specified in the index parameter.

  • Traverse: Reads in all parts of the multipart message sequentially in a loop using a Condition module. As soon as all parts have been read, the adapter returns the status 0.

Parameters

index

Index (position) of the part to be read in for the GetDocument operation.

Possible values:

  • Any positive integer (0 = default)

toXML

Output all header information of the multipart message as elements and the content of the read part Base64-encoded in an XML document.

Possible values:

  • yes: Output XML document with header information and body part

  • no: Output read multipart message as text (default)

Status values

1The operation was executed successfully.
0

The operation was executed successfully, but without any result.

-1The operation failed due to a technical error.

Examples

The adapter expects a multipart message as input

TEXT
From: John Doe <example@example.com>
MIME-Version: 1.0
Content-Type: multipart/mixed;
        boundary="XXXXboundary text"

This is a multipart message in MIME format.

--XXXXboundary text
Content-Type: text/plain

This is the body text at index 0

--XXXXboundary text
Content-Type: text/plain;
Content-Disposition: attachment;
        filename="test.txt"

This is the body text at index 1

--XXXXboundary text--

GetDocument

The operation GetDocument reads the following part if the index parameter is set to 0 and toXML is set to yes:

TEXT
This is the body text at index 0

Traverse

The operation Traverse reads all parts of the multipart message in a loop one after the other with the help of a Condition module. The following example has the following parameter configuration: index = 0 and toXML = yes.

In the 1st loop pass the first part (header information and body part) is read in as a base64 encoded element:

TEXT
<?xml version="1.0" encoding="UTF-8"?>
<document>
	<headers>
		<header>
			<name>Content-Type</name>
			<value>text/plain</value>
		</header>
	</headers>
	<content encoding="base64">VGhpcyBpcyB0aGUgYm9keSB0ZXh0IGF0IGluZGV4IDANCg==</content>
</document>

In the 2nd loop pass the second part (header information and body part) is read in as a Base64 encoded element:

TEXT
<?xml version="1.0" encoding="UTF-8"?>
<document>
	<headers>
		<header>
			<name>Content-Type</name>
			<value>text/plain;</value>
		</header>
		<header>
			<name>Content-Disposition</name>
			<value>attachment;
				filename="test.txt"
			</value>
		</header>
	</headers>
	<content encoding="base64">VGhpcyBpcyB0aGUgYm9keSB0ZXh0IGF0IGluZGV4IDENCg==</content>
</document>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.