Want procmail to run a custom python script, everytime a new mail shows up

后端 未结 2 577
情书的邮戳
情书的邮戳 2021-02-02 02:21

I have a pretty usual requirement with procmail but I am unable to get the results somehow. I have procmailrc file with this content:

:0
* ^To.*@myhost
| /usr/bi         


        
2条回答
  •  不思量自难忘°
    2021-02-02 02:41

    That is just fine, just put fw after :0 (:0 fw). Your python program will receive the mail on stdin. You have to 'echo' the possibly transformed mail on stdout.

    fw means:

    • f Consider the pipe as a filter.
    • w Wait for the filter or program to finish and check its exitcode (normally ignored); if the filter is unsuccessful, then the text will not have been filtered.

    My SPAM checker (bogofilter) just works like that. It adds headers and later procmail-rules do something depending on these headers.

提交回复
热议问题