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

后端 未结 2 584
情书的邮戳
情书的邮戳 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 03:01

    The log excerpt clearly states that your script is executed, even if it doesn't show the desired effect. I'd expect procmail to log an error if the execution failed.

    Anyway, make sure that the user (uid) that procmail is executed with has the correct permissions to execute your script. Wire the script into procmail only if you succeeded testing with something like this (replace 'procmail' with the correct uid):

    # sudo -u procmail /bin/sh -c '/bin/cat /work/scripts/mail.txt | /usr/bin/python /work/scripts/privilege_emails_forward.py'
    

    Depending on your sudo configuration, you'd have to run this as root. Oh, and make sure you use absolute file paths.

提交回复
热议问题