procmail
[Top] [All Lists]

Re: Procmail filter wrong name for email address

2010-09-18 11:57:10
At 17:05 2010-09-17, ProcMail wrote:
Good point, thank you! I'm rather new to ProcMail.

While on that point, perhaps you could change the name portion of your email to something other than "procmail", since somewhere along the line, someone's MUA is going to glom onto your address for auto-complete when they go to address the procmail list...

Can this be done:?
- No text = ignore,
- Text that includes 'mary' = ignore,
- Text NOT including 'mary' = action.

Something can always be done, it's just a matter of how obtuse you're willing to have the procmail code, or, if necessary, using an external script.

The following works within my sandbox (which, JFTR, extracts the TO: field to a variable for me). See my .sig for a link to download the sandbox.


:0
* ^To:(_dot_)*mary(_at_)domain\(_dot_)tld
{
        # use the TO (extracted) and zap the address portion
        # (replace it with nothing).
        # caution: $TO has not been sanitized
        TONOADDR=`echo "$TO" | sed -e 's/mary(_at_)domain\(_dot_)tld//'`

        :0
        * ! TONOADDR ?? mary
        * 1^1 TONOADDR ?? [a-z]
        {
                # score is number of alpha characters when non-address
                # portion doesn't include 'mary'.  We don't count
                # _symbols_ (quotes, commas, spaces, brackets, etc)
                # textual name violates criteria
                BAD=1
        }
}


Instances where there are multiple recipients in the To: will cause issues. Instances where your user is addressed as a Cc: would cause issues (excepting that the whole of the recipe is ONLY checking the To:)


Hopefully, this will give you some ideas to move forward with - I just can't expend the time to do your dev and test work, especially for something which, at least in my opinion, isn't of broad application to other users.

---
 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>