[Mailmunge] filter_recipient()
postfix at ptld.com
postfix at ptld.com
Thu Aug 12 10:25:00 EDT 2021
Im a little confused on proper usage of this callback. Manual says you
SHOULD return a Mailmunge::Response object. When i allowed the function
to just end by closing } it crashed mailmunge with this error:
mailmunge-mx[135295]: NOQUEUE: Worker 1 stderr: Can't call method
"fix_code_dsn" on an undefined value at
/usr/local/share/perl5/Mailmunge/Filter.pm line 952, <STDIN> line 1.
So i assume "should" is actually "must" and I added "return
Mailmunge::Response->CONTINUE();" at the end of the function and this
prevented mailmunge from crashing. But now the part im not clear on is
how to reject a mail message. Does this...
if (some == condition) {
$self->action_bounce($ctx, "Reason", 550, "5.7.1");
return;
}
# Or this...
return if $ctx->message_rejected();
...still meet the requirement for returning a response object? Or are
you not supposed to use $self->action_* in filter_recipient()? Is the
only acceptable return doing something like:
return Mailmunge::Response->REJECT(message => 'Message', code => 550,
DSN => '5.7.1');
Or can you request/set the reject separately like:
Mailmunge::Response->CONTINUE();
if (some == condition) {
Mailmunge::Response->REJECT(message => 'Message', code => 550, DSN
=> '5.7.1');
}
return;
In my situation i do sub-processing in nested functions called from
inside of filter_recipient() and would decided to reject a message in
one of these sub-functions. So i can't use return
Mailmunge::Response->*() in these sub-functions. What is the best way to
declare a reject from a sub-function?
More information about the Mailmunge
mailing list