parse_mime
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.
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.