简体   繁体   English

使用procmail将电子邮件复制到另一个地址并更改“来自”

[英]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 . formailsendmail之前,将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.

相关问题 使用 procmail 将电子邮件转发到另一个保留副本的帐户 - Using procmail forward emails to another account keeping a copy 如果发件人匹配,则使用procmail移动电子邮件 - Move emails with procmail if it matches from sender 配置procmail以在过滤电子邮件时匹配外部电子邮件地址列表 - Configure procmail to match an external email address list when filtering emails 使用GMail或其他ISP阻止电子邮件发送到垃圾邮件 - Using GMail or another ISP To Prevent emails from going to Spam 在 Gmail 中,使用 Google Apps 脚本,是否可以将收到的已翻译电子邮件转发到另一个 email 地址? - In Gmail, using Google Apps Script, is it possible to forward the TRANSLATED emails which I receive to another email address? 将电子邮件注入另一个用户的procmail - inject an email into another user's procmail Jira从用户地址发送电子邮件 - Jira send emails from user address 使用PHP Mailer从本地服务器外部的电子邮件地址发送smtp电子邮件 - Using PHP Mailer to send smtp emails from an email address outside the local server procmail是chroot还是使用Linux命令受到限制? - Is procmail chrooted or limited in using linux commands? 通过联系表格在 YII2 中发送电子邮件发送到另一个地址 - sending emails in YII2 via contact form sending to another address
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM