[Mailmunge] Mailmunge::Response syntax

Dianne Skoll dianne at skollsoft.com
Tue Jul 30 07:43:53 EDT 2024


On Tue, 30 Jul 2024 00:02:08 -0400
list--- via Mailmunge <mailmunge at lists.mailmunge.org> wrote:

> Just to clarify, which is the preferred way now inside
> filter_recipient{} ?

>    Mailmunge::Response->REJECT(...)
>    Mailmunge::Response->new(status => 'REJECT', ...)

Either one is fine; the first is just shorthand for the second.  Neither
one will be deprecated.  As for your second question:

> In filter_recipient{} im using
>    return Mailmunge::Response->REJECT(message => "Client blocked",
> code => 550, dsn => "5.7.1");

> And in filter_message{} im using
>    $ctx->action_bounce("Client blocked", 550, "5.7.1");
>    return;

> Is it still required to use the two different reject methods based on
> the filter_*{}, or can the same method be used in all filters? Id
> prefer to use the return Mailmunge::Response in all filters if
> possible.

The same method can be used in all filters.  Originally, only the
$ctx->action_XXX methods worked, because that's how Mailmunge's
predecessor MIMEDefang worked.  However, I added support for
retujrning a Mailmunge::Response object in order to make filters more
consistent.  Again, neither way will be deprecated and you can use
whichever you prefer.

Returning a Mailmunge::Response object ends up invoking one of the
action_* calls under the hood; this code is in the method
Mailmunge::Context::action_from_response in lib/Mailmunge/Context.pm

Regards,

Dianne.



More information about the Mailmunge mailing list