procmail
[Top] [All Lists]

Re: Deleting a single e-mail from a mailbox - mbox format

2001-08-09 06:21:02
* Matt Dunford <zoot(_at_)zotikos(_dot_)com> [20010809 15:38]: writing on the 
subject 'Re: Deleting a single e-mail from a mailbox - mbox format'
* Odhiambo Washington <wash(_at_)wananchi(_dot_)com> [010809 08:03]:
* Barrett W Clark <mgronduty(_at_)texoma(_dot_)net> [20010809 08:42]: 
writing on the subject 'Re: Deleting a single e-mail from a mailbox - mbox 
format'
Odhiambo,

I think you could use pine. (please correct me if I am wrong.)

i.e...pine -f /var/mail/some_mailbox

You should be able to view the mailbox and delete the problem e-mail.

Very correct and I can also use elm -f some_mailbox but that is not what I
wanted to do.
Say I have 2k mailboxes and someone has sent a mass mail to all those
mailboxes and I want to delete that mail before the others retrieve it.
I would want to match some condition, either From: or Subject: and pass
all these mailboxes to procmail somehow, you see the point why I asked
this on the procmail list and not pine-users ;-)

So this email has already been sent to 2k mailboxes and you want to get
rid of it.  You'd be using procmail as a postprocessor in this case.
Here's an idea.  Very, very, very untested.  Wouldn't it be funny if you
mangled 2k mailboxes?  And you would owe it all to me.. ;-)

#!/bin/bash

SPOOL=/path/to/your/mail/spool
BOXES=`ls $SPOOL`

cd $SPOOL
for mailbox in $BOXES
do
    tmpbox=/tmp/$mailbox
    mv $mailbox $tmpbox
    formail -s procmail -m rcfile <$tmpbox
    rm $tmpbox
done


Actually it is the line "formail -s procmail -m rcfile <$tmpbox" that I
had issues with. It is possible that my _only_ mistake was that I was dumb
(???) to specify and rcfile which had only the recipe lines and not the
usual variables defined on top, yes?? 

And in the rcfile is like so:

PATH=/bin:/usr/bin:/usr/local/bin
PMDIR=.LOG/
## LOGFILE: procmail's log file.
LOGFILE=$PMDIR/testlog.`/bin/date +%Y-%m`
FILEDIR=$PMDIR
VERBOSE=on
SHELL=/bin/sh
#
:0
* ^From(_dot_)*baduser(_at_)wananchi\(_dot_)com
/dev/null

Initially I specified a line like yours but my rcfile was only the recipe
;-)

Feasible??


As always, I am very grateful for your time.

Thanks

-Wash

--
Odhiambo Washington
Wananchi Online Ltd.,
wash(_at_)wananchi(_dot_)com 1st Flr Loita Hse.
Tel: 254 2 313985 Loita Street.,
Fax: 254 2 313922 PO Box 10286,00100-NAIROBI,KE.

Paper memories of plastic people. 
-Garfield (Jim Davis), refering to photographs 

Attachment: pgpGiNkVl0rxy.pgp
Description: PGP signature