当邮件到达邮件服务器时如何运行脚本?(Debian)

Rah*_*sad 6 email scripting linux debian postfix

我想解析并插入刚刚到达任务关键型应用程序邮件服务器的邮件中的一些信息。

我有什么方法可以配置我的邮件服务器,以便它在邮件到达时运行脚本。

虽然我有一个 debian 系统,但任何通用解决方案(Linux)都可以。

小智 7

看起来其他人已经回答了这个问题,但我想我会为你写下一个具体的答案。

我会使用 procmail 并在您的 .procmailrc 中使用类似于此的配方:

#turn this off when you're finished testing :)
VERBOSE=on
LOGFILE=/home/user/procmail.log

:0 c #the c means continue on after this recipe is parsed
| /path/to/your/script
Run Code Online (Sandbox Code Playgroud)

您还需要底部的默认配方来将邮件定向到您的 maildir。