> Hi there,
> I need some help, tried to find the answer googling for it, but no luck.
> Here's my question: I'd need to trigger a script whenever an email
> is processed and sent. This trigger should be based on some header
> fields (e.g. subject).
> I tried playing with header_checks but without getting anything.
> Can you please help me?
Postfix doesn't do that directly, but there are several round-about
ways to make it work.
One incomplete example:
Set up an alias that pipes to your script.
scriptuser: | /path/to/script
Use header_checks with a BCC action to send trigger mail to the
/^target text$/ BCC sciptuser@localhost
Note this requires localhost is listed in mydomains and is delivered
by the postfix local delivery agent.
Alternately, you can probably convince regex-milter to do this.
The major problem is i have not figured out how to deliver the original email that triggered the filter
in the first place.
here is logs of it working, and running my "angelo" script based on email subject
Dec 5 13:34:42 mta5 postfix/smtpd: connect from angelo.uits.uconn.edu[188.8.131.52]
Dec 5 13:34:43 mta5 postfix/smtpd: 092653000371: client=angelo.uits.uconn.edu[184.108.40.206]
Dec 5 13:34:43 mta5 postfix/cleanup: 092653000371: filter: header Subject: this is stuff in here from angelo.uits.uconn.edu[220.127.116.11]; from=<[hidden email]>
to=<[hidden email]> proto=ESMTP helo=<[18.104.22.168]>: filter:
Dec 5 13:34:43 mta5 postfix/cleanup: 092653000371: message-id=<[hidden email]>
Dec 5 13:34:43 mta5 opendkim: 092653000371: DKIM-Signature field added (s=dkim1, d=mta5.uits.uconn.edu)