procmail
[Top] [All Lists]

Re: help with procmail rules

2008-07-29 09:14:37
At 09:59 2008-07-29 -0500, Adam Williams wrote:
I have a user, rmiller(_at_)mdah(_dot_)state(_dot_)ms(_dot_)us who wants all of his To: and Cc: email to go to his millerono(_at_)gmail(_dot_)com as well as keeping a copy of the email on our mdah.state.ms.us mail server in his inbox. However, when he sends mail from millerono(_at_)gmail(_dot_)com he will Bcc: the email to rmiller(_at_)mdah(_dot_)state(_dot_)ms(_dot_)us so that we have a a copy of his email. Are the following procmail rules below correct to accomplish this?

Er, if the rules are in his user procmailrc, you could just add logic to check for a From: his address, and forward anything not From him. Then he'd catch Bcc's that he didn't send (such as LISTS).

:0:
* $ ^Bcc:(_dot_)*rmiller(_at_)mdah(_dot_)state(_dot_)ms(_dot_)us
${DEFAULT}

You generally will never SEE a Bcc: header - it's something an MSA will generally strip after extracting addresses to SEND a message to, and shouldn't be introduced by a receiving server. Thus, Perhaps you should be looking for a From: the same address, or just accept that any message NOT cleartexted (To|Cc) to the address should bypass the recipe you have for forwarding a copy, and thus end up in DEFAULT by, well, default. IOW, you should be able to just eliminate the above recipe.

Combine your other two into:

:0c
* ^(To|Cc):(_dot_)*rmiller(_at_)mdah\(_dot_)state\(_dot_)ms\(_dot_)us
! millerono(_at_)gmail(_dot_)com

(the original copy of the message would continue along in the rcfile to be delivered however it should be - possibly by other recipes taking action)

Better yet, add an X-Loop, and reconsider forwarding Mailer messages (which _could_ be a mail loop in waiting):

:0c
* ^(To|Cc):(_dot_)*rmiller(_at_)mdah\(_dot_)state\(_dot_)ms\(_dot_)us
* ! ^FROM_MAILER
* ! ^X-Loop:[   ]*rmiller_mdah
| formail -A "X-Loop: rmiller_mdah" | $SENDMAIL millerono(_at_)gmail(_dot_)com


This would forward a copy of the message so long as it was cleartexted to to the user but didn't come from a mailer, and didn't contain a reference to the X-Loop which would have been inserted on forwarded messages.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>