views:

23

answers:

2

Hi,

as im using different email clients to read/send my mails i want to setup procmail to move my emails to a the folder which is normally done by Thunderbird filter feature.

I know that i can do it by using the following code for procmail in my email users .procmailrc file:

:0:
* ^From:[email protected]
myfolder

But i have a list of about 50 email adresses which i would like to move to that specific "myfolder".

So by using

:0:
* ^From:[email protected]
* ^From:[email protected]
jimsmail

doesnt help, because procmail interprets them by using the AND operater. So the code above would be true if From is first@... AND second@..., which will never be true.

So how do i use the OR operator.

Actually i have a simple text file where all email adresses are. Would be cool to have a feature where procmail ready in that file and checks if From matches with at least one of the lines in the file, the moves email to "myfolder".

Something like

 :0:
 * ^From:file(email.txt)
 myfolder

Does anybode if this or something similar is possible. I dont want to add these 3 lines 50 times in my procmailrc file.

A: 

Procmail uses regexps, so you can separate addresses with the | character.

:0:
* ^From:.((first|second|third)@mail.com|(fourth|fifth)@othermail.com)
myfolder

would work. Could get a little messy with fifty all on one line, mind...

John Yeates
hm that one doesnt work.in the logs it shows no error. but somehow there is no match.the line looks like this: * ^From:.([email protected]|[email protected])
NovumCoder
A: 

I found the solution. With this solution im able to use a simple email text file holding all email addresses in each in one line.

The code in my .procmailrc is as follows:

EMAILFILE=/path/to/my/emailfile
FROM=`formail -xFrom: | sed -e 's/ *(.*)//; s/>.*//; s/.*[:<] *//'`
:0
* ? fgrep -qxis $FROM $EMAILFILE
myfolder
NovumCoder