procmail
[Top] [All Lists]

Re: sorting based on domain and receiver

2010-02-04 04:30:47
frantisek holop wrote:
i'd like to create a recipe to automatically sort
incoming mails into folders in the form of: brand-country

e.g.
austria(_at_)mybrand1(_dot_)com -> mybrand1-austria
germany(_at_)mybrand1(_dot_)com -> mybrand1-germany
germany(_at_)mybrand2(_dot_)com -> mybrand2-germany
etc.

as far as i can tell from the man pages, MATCH is not
too flexible for this....
You will need to extract the desired information in multiple steps. Alternatively you can convert the e-mail address using an external program, something like (untested)

:0 fh
* ^To:.*\/[a-z]*(_at_)[a-z]*\(_dot_)com
| formail -A `perl -npe "s/^(.*)\@(.*)\..*$/X-Folder: \\2-\\1/"`

:0
* ^X-Folder: \/
/path/$MATCH

--
Klaus Johannes Rusch
KlausRusch(_at_)atmedia(_dot_)net
http://www.atmedia.net/KlausRusch/

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