Deleting email message using imaplib?
bsneddon at yahoo.com
Mon Aug 25 22:14:45 CEST 2003
Anyone have an example they are willing to share that shows
how to use the store command in imaplib?
store( message_set, command, flag_list)
Alters flag dispositions for messages in mailbox.
I have been unable to find one or get the syntax correct through
trial and error.
I can send the command to the server in the following manor.
The only problem is I can not get the response back from the server.
I tried the recent() and the responce(code) objects with no success.
Not sure what the code should be.
I would be open to a different approach to delete a message if one exist.
This is example of deleting from PythonWin.
>>> m.send('A003 STORE 2:4 +FLAGS (\Deleted)')
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python23\lib\imaplib.py", line 402, in expunge
typ, dat = self._simple_command(name)
File "C:\Python23\lib\imaplib.py", line 1000, in _simple_command
return self._command_complete(name, self._command(name, *args))
File "C:\Python23\lib\imaplib.py", line 832, in _command_complete
raise self.abort('command: %s => %s' % (name, val))
abort: command: EXPUNGE => unexpected response: 'A0032 OK STORE completed'
('OK', ['2', '2', '2'])
Thanks for your help. Sorry if this is a FAQ but I looked and could not
find the answer.
More information about the Python-list