I'm using procmail
with Maildir/
and easy rules like the one below to save incoming emails into directories:
:0:
* ^X-Spam-Status: Yes
Spam/
Now I would like a desktop notification on new emails in certain directories/rules, I know already how to handle notifications but how to tell procmail
to save into a directory and execute a script?
I know I can pipe a |command
but I would prefer to let procmail
saving the file, then just run a script.
Having the email (headers at least) in pipe or the dir+file path as arguments would be nice, run the script asynchronous would also be nice.
update
So, based on @slm's answer that's the result:
:0 c:
* ^X-Spam-Status: Yes
Spam/
:0 Whi
* ^X-Spam-Status: Yes
| $HOME/install/bin/notify.sh
c
copy the message in the directory but goes on with next rules
I'm not using f
becase that's not a filter, if the rule match I want procmail to stop here (I hope I'm not misunderstanding the manual here)
W
to suppress any program failure
h
to pipe only headers
i
to ignore any write error to the pipe
I'm not using w
because don't want to wait the script to return
I think I don't need a lock file too (no :
after Whi
)
update 12/5/14
In the end I've adopted exactly the solution @tripleee proposed.
Played around also with mailutils-comsatd
for few minutes before give up.
.procmailrc:
COMSAT=no