[Tutor] imaplib command to delete messages

Emile van Sebille emile at fenx.com
Sat Feb 27 17:59:02 CET 2010


On 2/26/2010 11:48 AM Bill Campbell said...
> I've written a script to go through varions Sent folders on
> IMAP servers to archive the messages on a central server using
> imaplib to do the heavy lifting.  Perhaps I'm a bit thick, but I
> have not been able to figure out how to delete messages in the
> folders after processing them.  The imaplib documentation as lots
> of ways to delete mailboxes (folders) and expunge messages from
> folders, but I don't see anything about marking individual
> messages as deleted.

I can't confirm it's still current, but this tip from Donn Cave might help:

It's only a flag, to identify the message that as you noted
will be actually deleted later by an expunge.


  ok, error = imapobject.store(number, 'FLAGS', '(\Deleted)')



(from 
http://groups.google.com/group/comp.lang.python/browse_thread/thread/dfd041398e86c1fd/884359798ce1e025?q=python+imaplib+delete+message)

Emile

>
> What am I missing?
>
> Bill




More information about the Tutor mailing list