Skip to content

body

local content = mimepart.body
mimepart.body = 'changed content'

Note

This is a field rather than a method, so you must use mimepart.body rather than mimepart:body to reference it.

Since: Dev Builds Only

The functionality described in this section requires a dev build of KumoMTA. You can obtain a dev build by following the instructions in the Installation section.

The body field allows reading or writing the transfer-decoded content of the mimepart. For example, if the incoming message has base64 encoded the content and applied a Content-Transfer-Encoding header on the part to indicate that it is base64 encoded, mimepart.body will base64-decode the content before returning the bytes to your code.

If/when you assign the body field, appropriate transfer encoding will be applied to the raw content that you provide.

Note

Replacing the content doesn't implicitly change the Content-Type of the part, so you are responsible for ensuring that any modification you make to the part keeps the resulting message logically correct. See also mimepart:replace_body for a variation of this that allows you to change the Content-Type as part of the assignment.