[Mailmunge] Email parts in filter_message

Dianne Skoll dianne at skollsoft.com
Wed Oct 26 11:28:35 EDT 2022


On Wed, 26 Oct 2022 10:19:04 +0200
Ernst du Plooy via Mailmunge <mailmunge at lists.mailmunge.org> wrote:

> MimeDefang will be executed.  If I, however, want to run MailMunge
> using Mailmunge::Filter and use filter_message instead, how do I
> execute actions for each part?

You have to recurse into the MIME object yourself.  filter_message
is passed a Mailmunge::Context object $ctx.  You get at the
MIME::Entity object with $ctx->mime_entity.

Then you need to familiarize yourself with the MIME::Entity man page
and look at the methods for accessing sub-parts.  Also, you can look
at the code in Mailmunge/Filter/Compat.pm for an example of how
its filter_message method recurses through the MIME parts.  Most of
the real work is done by the private method _rebuild_entity in that
file.

That said, if Mailmunge::Filter::Compat is more convenient for you to
use than Mailmunge::Filter, by all means use it... it's not going to
disappear.

Regards,

Dianne.


More information about the Mailmunge mailing list