I have a postfix server. 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]
The output of the command (STDOUT) should be put somewhere in the MIME headers. My first idea would be to put this through a content filter, but thats pretty useless, imagine if someone sends a 100MB body with some attached files. It would be a big performance bottleneck to run such a mail through a perl or shell script, because of the large body. So its there any way to only filter the initial MIME headers, and not have the script deal with the body? I was also thinking of using header_checks, but I dont know if I can execute commands with PCRE? Also: I dont want this command to execute while the SMTP server is talking with the client, since then the client will timeout (the above command takes roughtly ~5 minutes to execute), rather, I want to execute this command when the mail is in queue ready to be dispatched to its relay destination. (after eventual milters) The command should also NOT be executed on incoming mail (to be delivered or redirected to any local mailbox). Any ideas?