imaplib question
Laszlo Nagy
gandalf at designaproduct.biz
Fri Jul 14 10:25:57 EDT 2006
Laszlo Nagy írta:
> Hello,
>
> I'm trying to write a very simple program that moves all messages from
> INBOX into another folder.
> I'm not sure what am I doing wrong. This is a very simple task. I
> believe I need to call these methods:
>
> - search -> get all message UIDs in the INBOX
> - copy -> copy all messages to another folder
> - store -> mark all messages in INBOX as deleted
> - expunge -> delete them physically
>
Here is another try:
conn = getnewimapconnection()
try:
typ,data = conn.select('INBOX',True)
check_error((typ,data))
# Store all messages into another
for uid in all_messages[0].split():
print uid
typ,data = conn.uid('COPY',uid,'PublicInbox')
check_error((typ,data))
finally:
conn.logout()
It does not raise any exception, but the messages are NOT copied to
PublicInbox.
Laszlo
More information about the Python-list
mailing list