How to make qmail to feed email into shell command?

I have some server running qmail, with many users/domains configured via plesk. I would like to get emails from specified address delivered to one of my users being feed to shell command, as addition to normal delivery. So, basically, I have some shell script, and I'd like qmail to invoke my script with the email, and the continued with delivery as usual.

If necessary, I can do recipient/sender filterind on script side, though it could be more efficient and cleaner, if qmail would feed only correct emails to my script.

Anyway, how to accomplish that?


Solution 1:

You can use dot-qmail files. Literally, you would just prefix the first line with a | and run it through a command. The second line would specify the user to deliver the mail to.

For example:

|/usr/bin/procmail
&user1

This would pipe all e-Mail through procmail and then deliver to the local system user user1.