[英]Using procmail to copy emails to another address and altering “from”
I get email alerts that are generated by a user on one of my servers. 我收到由用户在我的一台服务器上生成的电子邮件警报。 These alerts are generated by server@######.com and they have to do with third party software not working properly.
这些警报是由server@######.com生成的,它们与第三方软件无法正常运行有关。
I'm trying to use procmail to copy (as I want to keep receiving these) these emails to ABC@XYZ.com. 我正在尝试使用procmail将这些电子邮件复制(因为我想继续接收这些邮件)到ABC@XYZ.com。
I'm looking for emails that, in their body, have "C:" followed by 6 characters, a dot, and 3 more characters. 我正在寻找在其正文中带有“ C:”,后跟6个字符,一个点和另外3个字符的电子邮件。 All of that is working fine, but I want the third party to get these emails from me bruno@XXXXXX.com rather than server.
所有这些都工作正常,但是我希望第三方从我而不是服务器那里获得bruno@XXXXXX.com的这些电子邮件。
How can I copy the email to a third party AND change the from address to be bruno@XXXXX.com? 如何将电子邮件复制到第三方并将发件人地址更改为bruno@XXXXX.com?
Here's the procmail file: 这是procmail文件:
cat .procmailrc
DROPPRIVS=yes
LOGFILE=$HOME/procmail.log
:0 c:
* B ?? C:......\....
! ABC@XYZ.com
:0 B:
* ^To: .*alerts@XXXXXX.com
! bruno@XXXXXX.com
Inject the headers you want with formail
before piping to sendmail
. 在
formail
到sendmail
之前,将formail
的标头与formail
一起formail
。 (Recall that !
is basically a shorthand for | $SENDMAIL $SENDMAILFLAGS
.) (记得
!
基本上是| $SENDMAIL $SENDMAILFLAGS
的简写。)
Do I understand correctly that the first recipe is the one you would like to modify? 我是否正确理解第一个配方是您要修改的?
:0 c # No lockfile when forwarding
* B ?? C:......\....
| formail -I 'From: bruno@XXXXXX.com' \
| $SENDMAIL $SENDMAILFLAGS ABC@XYZ.com
Your second recipe similarly should not have a lock file; 同样,您的第二个食谱不应包含锁定文件; see http://www.iki.fi/era/procmail/mini-faq.html#locking
参见http://www.iki.fi/era/procmail/mini-faq.html#locking
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.