parse_mime
Since: Version 2025.10.06-5ec871ab
The functionality described in this section requires version 2025.10.06-5ec871ab of KumoMTA, or a more recent version.
Returns a MimePart representation of the message content.
Note
While you can modify the returned mime structure, any such changes are not
automatically reflected in the message content. You must explicitly re-assign
the content via msg:set_data(tostring(mime_part)) to apply them.
Example: attachment extraction
This demonstrates how to obtain a list of all attachments found (recursively) in the incoming message and print out the file name, content type and the decoded content.
This is not a useful production-ready example (you definitely don't want to log all of the attachment content like this!) but can serve as a starting point for policies that need to operate on attachments for scanning, compliance or automation purposes.