procmail
[Top] [All Lists]

Re: Filtering e-mail by subject and creating IMAP folder

2002-03-06 00:49:38
On Wed, 6 Mar 2002, Dapid Candra wrote:

[...]
The problem is, I do not know what string I will encounter, but I know it
is the second string in subject line ($2 if I use awk). So, I can not use
the recipe that specifically define the string.

I have read http://www.ii.com/internet/robots/procmail/qs/, but there is no
explanation on how I could do extraction by string position.

        Unfortunatly, there is no string position in procmail.
        The following find the second word from the Subject:


SHELL=/bin/sh

:0
* Subject: *[^  ]+[     ]+\/.+
{
DR=/var/tmp/$MATCH
DUMMY=`test -d $DR || mkdir $DR`

        :0
        $DR/
}


        Note the "+"
        Note that [   ] is:  "[" and SPACE and TAB and "]"

Bye,
 Udi




So, in more specific way, I need to extract second string in subject line
(with space as delimiter), check if there is mailbox with that name. If
not, then create and forward mail to the mailbox, if yes forward the mail
to the mailbox.

On 05-Mar-02 at 12:43 Udi Mottelo wrote:

    Yes, I did, I just cut and paste the example from the man procmailex:

:0 Wic
* ? test ! -d abc
| mkdir abc

:0:
* abc
abc


    Other way which I did not tried:

DUMMY=`test -d abc || mkdir abc`

:0:
* abc
abc


    Hummm, just to feel safe, confirm that your rc file begin with

SHELL=/bin/sh


Bye,
Udi

*********** REPLY SEPARATOR  ***********



Dapid Candra
-------------------------------------------------------------------
Terima SMS dapet duit: 
      http://www.smsreward.com/registrasi/?reff_id=1-0203-ZMP-30544





--


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail