【发布时间】:2018-05-09 07:58:53
【问题描述】:
这几天,我一直在尝试编写 procmail 脚本。
我想转发消息,并在消息内容中注入一些文本。
我想要完成的事情:
- 有人给我发电子邮件,主题中包含“天气”一词
- 电子邮件被转发到地址“mymail@somedomain.com”
- 每封转发的电子邮件都会在内容中添加一些文本
但到目前为止,没有成功。
在.procmail.log,有一条消息“procmail: Missing action”
SHELL=/bin/bash
VERBOSE=off
LOGFILE=/home/test/.procmail.log
LOGDATE_=`/bin/date +%Y-%m-%d`
:0
* ^Subject:.*weather
:0 bfw
| echo "This is injected text" ; echo "" ; cat
:0 c
! mymail@somedomain.com
当我查看电子邮件源时,我看到文本被注入。 但是地方不对……
看看:
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------148F3F0AD3D65DD3F3498ACA"
Content-Language: pl
Status:
X-EsetId: 37303A29AA1D9F60667466
This is injected text
This is a multi-part message in MIME format.
--------------148F3F0AD3D65DD3F3498ACA
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
CONTENT CONTENT CONTENT
*********************************************************
应将注入的文本放置在内容所在的位置。现在它在上面...
【问题讨论】:
-
就像错误消息一样,您没有对具有条件
^Subject:.*weather的配方执行操作。不幸的是,不起作用的代码是一种糟糕的方式来解释您确实想要什么,但也许您正在寻找大括号? iki.fi/era/procmail/mini-faq.html#recipe-block