1

我想创建一个 procmail 配方或 Perl 或 shell 脚本,它将向原始发件人以及在原始电子邮件中复制的任何人(收件人:或抄送:)发送自动回复。

例子:

bob@example.com 给 john@example.com 和 paul@example.com 写一封电子邮件(在收件人:字段中)。副本通过 cc: 发送至 rob@example.com 和 alice@example.com。

我希望脚本向原始发件人 (bob@example.com) 和发送电子邮件副本的其他所有人 (john@example.com、paul@example.com、rob@example. com 和 alice@example.com)。

谢谢

4

2 回答 2

2
FROM=`formail -rtzxTo:`
CC=`formail -zxTo: -zxCc: | tr '\n' ,`

:0c
| ( echo To: "$FROM"; echo Cc: "$CC"; echo Subject: auto-reply; \
    echo; echo Please ignore. ) \
  | $SENDMAIL -oi -t

A well-formed auto-reply should set some additional headers etc; but this should hopefully be enough to get you started. See also http://porkmail.org/era/mail/autoresponder-faq.html

Depending on you flavor of tr you might need to encode the newline differently; not all implementations of tr understand the '\n' format. Try with '\012' or a literal newline in single quotes if you cannot get this to work.

于 2011-09-09T07:56:04.110 回答
2

您应该能够使用Perl 5的this procmail模块来完成此操作。您也可以只使用 procmail 配置文件来完成此操作。

这是我们的 procmail 配置“通过”perl 脚本发送电子邮件的示例。

:0fw
* < 500000
| /etc/smrsh/decode_subject.pl

我希望这有助于你开始。

于 2009-09-14T17:33:27.117 回答