[Mailmunge] {rcpt_addr} Macro

Dianne Skoll dianne at skollsoft.com
Wed Aug 18 11:22:25 EDT 2021


On Wed, 18 Aug 2021 10:59:59 -0400
postfix--- via Mailmunge <mailmunge at lists.mailmunge.org> wrote:

> Trying to access $ctx->sendmail_macro('rcpt_addr') inside 
> filter_recipient() and im getting undef.

rcpt_addr, rcpt_mailer and rcpt_host are unusual in that they change
for each RCPT command.  As such, you can't access them as macros.
Instead, as per the documentation (which I encourage you to read
carefully before posting on the list) you access them within
filter_recipient as $ctx->rcpt_addr, $ctx->rcpt_mailer and
$ctx->rcpt_host, respectively.

> From my understanding, the filter_recipient() is ran each time a
> client issues a RCPT TO command, so it can only ever have a single
> email address. What is the purpose of the $ctx->recipients array
> when it will only have one element and there is $ctx->rcpt_addr?

Two answers: One is for closer backward-compatibility with MIMEDefang,
and the other is to open the possibility of sharing functions that you
write between filter_recipient and filter_message, which can simply
examine $ctx->recipients and be sure the recipient(s) in question are
there.

Regards,

Dianne.


More information about the Mailmunge mailing list