setting email FLAGs in IMAP4 box

Christian Rothe crothe at zes.com
Tue Feb 10 07:31:01 EST 2004


Hello Everybody, I need your help,

I'm trying to write a simple forwarding script with python2.2. I want
to forward unseen emails to another box after two days. This script
runs every morning by a cron ob. Everything works fine, but I cannot
set a flag for the forwarded emails. Best would be to create an own
flag to identify mails, that are forwarded a day before. I don't know
how to create an own flag. If I try to use an existing flag like
'UNSEEN', 'Deleted'.. or so, I use the commands:

     imap = imaplib.IMAP4("hostname")
     imap.login("name","passwd")
     imap.select("INBOX",1)
     imap.store(1, 'FLAGS', '(\Deleted)')

, but it doesn't work. I always get the message

     ('NO', ['Permission denied'])

Other commands are working fine, e.g.

     >>> imap.fetch(1,"INTERNALDATE")
     ('OK', ['1 (INTERNALDATE "29-Jan-2004 11:43:41 +0100")'])

How can I get 'Permissions' to change flags?? Does anybody know??

best regards
Christian Rothe



More information about the Python-list mailing list