(using the IMAP commands, not with the assistance of any other mail package)
+1
A:
I guess you COPY the message to the new folder and then delete (EXPUNGE) it in the old one.
HINT There's no DELETE command that does what you mean, you have to flag the message as deleted and then EXPUNGE the mailbox. Have a look at the RFC. Be careful with DELETE, as it deletes whole mailboxes, not single mails.
jkramer
2008-09-23 16:58:03
+3
A:
I'm not sure how well-versed you are in imap-speak, but basically after login, "SELECT" the source mailbox, "COPY" the messages, and "EXPUNGE" the messages (or "DELETE" the old mailbox if it is empty now :-).
a login a s
b select source
c copy 1 othermbox
d store 1 +flags (\Deleted)
e expunge
would be an example of messages to send. (Note: imap messages require a uniqe prefix before each command, thus the "a b c" in front)
See RFC 2060 for details.
Sec
2008-09-23 16:59:10
A:
* i suppose one has a uid of the email which is going to be moved.
import imaplib
obj = imaplib.IMAP4_SSL('imap.gmail.com', 993)
obj.login('username', 'password')
obj.select(src_folder_name)
apply_lbl_msg = obj.uid('COPY', msg_uid, desti_folder_name)
if apply_lbl_msg[0] == 'OK':
mov, data = obj.uid('STORE', msg_uid , '+FLAGS', '(\Deleted)')
obj.expunge()
Avadhesh
2010-07-01 09:28:21