Sebastian Nielsen:
> On the server, on mail put in outgoing queue (to be relayed), I
> want to run the following command: /usr/bin/hashcash -mXb 26
> [recipient01] [recipient02] .. [recipientNN]

Wietse:
> Use a Milter, written in Python or Perl. It needs to receive the
> "end of message" event and from there it needs to invoke the "insert
> header" action. For example, pymilter or pmilter.

Sebastian Nielsen:
> My next problem is that " $recipient = $ctx->getsymval('{rcpt_addr}'); " 
> only return the latest recipient.

You need to register a handler for the RCPT command (in addition to
the end-of-message handler).

Oh, and DO NOT USE A SHELL when invoking the command, otherwise you
are re-implementing the PHF security hole (enter those three words
into a web search engine to educate yourself).

Untested code follows:

# Initialization in CONNECT event handler.
@command = ("|- ", "/usr/bin/hashcash", "-mXb", "26");

# Update the command with each RCPT event.
push(@command, $recipient);

# Finally, run hashcash.
open(HANDLE, @command) || die "cannot run /usr/bin/hashcash: $!\n";
while (<HANDLE>) { ... }

        Wietse

Reply via email to