Postfix: triggering perl script on receipt of each email
I've done a similar thing by periodically scanning mailboxes, but I would like it to be more immediately reactive.
Thanks in advance.
EDIT: I guess I could piggyback off the Spam Assassin process, which is run for each email. Is there a better way?
3 Replies
are afewoptions
A simpler method might be to watch the directory containing mailboxes with something like inotifywaitsimilar modules
All these options could cause bad things to happen to my mail if my script doesn't behave properly. This is a possibiilty due to my limited perl skills. And, you're right, filtering is complex if we don't use the simple (and dangerous) example that Postfix provides.
The ionotify options with perl appears to require a persistent process to wait for the trigger, which I would prefer not to have.
I think I will stick with periodically scanning mailboxes. Thanks for your reply, though.