Linode Forum
https://forum.linode.com/

Postfix: triggering perl script on receipt of each email
https://forum.linode.com/viewtopic.php?f=11&t=6181
Page 1 of 1

Author:  hobbes7 [ Tue Oct 26, 2010 6:01 am ]
Post subject:  Postfix: triggering perl script on receipt of each email

So, I have a nice Postfix system up and running, using the Linode HOWTO in the library. Virtual users, with MySQL authentication, etc. I would like Postfix to trigger a perl script on the receipt of every email, with the raw email data as a parameter. Is this possible? If so, how?

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?

Author:  Vance [ Wed Oct 27, 2010 1:00 am ]
Post subject: 

There are a few options for integrating filters into Postfix, but they can be... complex.

A simpler method might be to watch the directory containing mailboxes with something like inotifywait (looks like similar modules are available for Perl).

Author:  hobbes7 [ Thu Oct 28, 2010 4:54 am ]
Post subject: 

Thanks for the info.

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.

Author:  jed [ Thu Oct 28, 2010 11:34 am ]
Post subject: 

Periodic might be better. If you receive a sudden deluge of mail and your Perl is expensive, it might result in a denial of service.

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/