I think what you're looking for is perhaps better implemented using sendmail. Since procmail in the case of redirection in any case just hands over the mail to sendmail.
Use the following directive in your sendmail virtual user table:
Generally speaking .procmailrc files are deployed per user. That is, user "jack" will have one and user "jill" will have a different one. With that restriction, it's not really possible to have a single .procmailrc file act on "all the mails received at mydomain.com".
However, your server might be configured to send all incoming e-mail to a single user's account. In that case, you have the very difficult task of figuring out the intended recipient of each incoming message. While that might sound simple, it is not. You can use procmail to parse the To and Cc headers, but that does not account for Bcc's and things like mailing list servers that do not include this information in the header.
See this warning and some of the suggestions given.
Steen's suggestion to use your MTA (sendmail, postfix, etc.) to do the redirection is a good one.
发布评论
评论(2)
我认为您正在寻找的内容也许使用 sendmail 可以更好地实现。 由于procmail在重定向的情况下无论如何都只是将邮件交给sendmail。
在 sendmail 虚拟用户表中使用以下指令:
这将有效地将 mydomain.com 上的每个用户映射到远程 mydomain.net
我不确定 procmail 中是否允许像上面这样通用的内容,我只使用过 procmail用于过滤我的个人邮件。
I think what you're looking for is perhaps better implemented using sendmail. Since procmail in the case of redirection in any case just hands over the mail to sendmail.
Use the following directive in your sendmail virtual user table:
which effectively will map every user at mydomain.com to the remote mydomain.net
I'm not sure if something as general as the above is allowed in procmail, i've only used procmail for filtering my personal mail.
一般来说,.procmailrc 文件是按用户部署的。 也就是说,用户“jack”将拥有一个,而用户“jill”将拥有不同的一个。 由于该限制,实际上不可能让单个 .procmailrc 文件作用于“在 mydomain.com 收到的所有邮件”。
但是,您的服务器可能配置为将所有传入电子邮件发送到单个用户的帐户。 在这种情况下,您将面临一项非常艰巨的任务:找出每条传入消息的预期收件人。 虽然这听起来很简单,但事实并非如此。 您可以使用 procmail 来解析“收件人”和“抄送”标头,但这并不能说明密件抄送以及邮件列表服务器等在标头中不包含此信息的内容。
请参阅此警告以及给出的一些建议。
Steen 建议使用 MTA(sendmail、postfix 等)进行重定向,这是一个很好的建议。
--
BB
Generally speaking .procmailrc files are deployed per user. That is, user "jack" will have one and user "jill" will have a different one. With that restriction, it's not really possible to have a single .procmailrc file act on "all the mails received at mydomain.com".
However, your server might be configured to send all incoming e-mail to a single user's account. In that case, you have the very difficult task of figuring out the intended recipient of each incoming message. While that might sound simple, it is not. You can use procmail to parse the To and Cc headers, but that does not account for Bcc's and things like mailing list servers that do not include this information in the header.
See this warning and some of the suggestions given.
Steen's suggestion to use your MTA (sendmail, postfix, etc.) to do the redirection is a good one.
--
bmb