procmail
[Top] [All Lists]

Re: How to filter aldready delivered email

2004-12-08 09:09:05
Am 2004-12-08 15:04:28, schrieb Jan Banan:

I tried this and created a .procmailrc like this:
      SHELL=/bin/sh
      PATH=$HOME/bin:/bin:/usr/bin:/usr/local/bin
      MAILDIR=$HOME/Maildir
      DEFAULT=$MAILDIR/
      :0
      * ^Sender: (_dot_)*thelist-list-bounces(_at_)list(_dot_)com
      $MAILDIR/.thelist/
        ^^^^^^^^
Change it to
        .thelist/
:-)

Then I tried to filter one email like this:
      cat 
~/Maildir/cur/101405463.M298580P16461V0000000000000701I006AE554_0.mymailhost,S\=2452\:2,S
 
| formail -ds procmail

I get this error message (is it possible to avoid?):
      procmail: Couldn't create "/var/spool/mail/myuser"

This is not normal, because it tries to write to "/var/spool/mail/myuser"

Du you call the script as user MYUSER ?
or as root ?

I call it allwas as $USER and it use ~/.procmailrc and nothing else

Is it possible to solve 1 and 2? If I just knew the output filename 
("1102514170.7652_2.mymailhost") and the location 
(Maildir/.thelist/new/) I could in a script rename the result and then 
change the timestamp back with "touch".

The timestamp/filename produced by 'procmail' are valid timestampe
for IMAP-Servers and you do not need to change anything there.

I am using "courier-imap-ssl"

If you realy need the original-filename, you need to do filtering by
yourself and not 'procmail'. You can extract Header informations with
formail for example...

  ____( stdin )_________________________________________________________
 /
| #!/bin/bash
| 
| 
| RET_SENDER=`cat $1 |formail -c -x Sender:`
| echo $RET_SENDER |grep "thelist-list-bounces(_at_)list(_dot_)com" /dev/null 
2>&1
| ES=$?
| if [ $ES == 0 ] ; then
|   mv $1 $HOME/Maildir/.thelist/cur/
| fi
 \______________________________________________________________________

So if the exit status of grep return a TRUE
we move the file from the old location to the new one.

Thanks for your help!

Best regards,
Jan


Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature

____________________________________________________________
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