Mailbox cleaner on an IMAP basis?

John Roth newsgroups at jhrothjr.com
Mon Sep 22 15:03:30 EDT 2003


"F. GEIGER" <fgeiger at datec.at> wrote in message
news:3f6f2cfb at news.swissonline.ch...
> Hi all!
>
> As I saw Alex Martelli's post about a mbox cleaner based on POP3, I
thought,
> it could be possible to do that based on IMAP too. That way I could ask
the
> server for mails having attached EXE files and delete all those mails on
the
> server. This would save me a lot of traffic over my phone line connection.
>
> But I'm missing one important thing: How do I get the server to tell me
> about attachments.
>
> What I've found out so far is how to get at the fields:
>
> r, d = i.fetch(1, "(BODY.PEEK[HEADER.FIELDS])")
>
> Alas, there's no such thing like 'filename' or 'attachments'.
>
> And
>
> r, d = i.fetch(1, "(BODY.PEEK[HEADER.FIELDS (Content-type)])")
>
> doesn't show a file name either.
>
> Any hints?

Right now, I'd simply like something that would clean out an
IMAP mailbox on a regular basis. Most of the worm generated
garbage is going into one of two boxes on my server, and I get maybe
one legitimate e-mail in those two boxes every couple of weeks.
I can stand to lose that level of e-mail, I can't stand to exceed my disk
quota and lose lots of legitimate mail every few hours.

Could you post the code you've got so far?

Thanks.

John Roth
>
> Best regards
> Franz GEIGER
>
>
>
>
>






More information about the Python-list mailing list