About IMAP UID with imaplib

我与影子孤独终老i 提交于 2020-01-17 07:59:12

问题


I try to move email from mailbox's gmail to another one, Just curious that UID of each email will change when move to new mailbox ?


回答1:


Yes of course the UID is changed when you do move operation. the new UID for that mail will be the next UID from the destination folder. (i.e if the last mail UID of the destination folder is : 9332 , then the UID of the move email will be 9333)

Note: UID is changed but the Message-Id will not be changed during any operation on that mail)




回答2:


I took a look at my own IMAP code for Gmail, and one of the comments say that UID changes on move, because move is in fact copy+delete. Or maybe it's me who do the wrong thing:

    imap.copy(sid, dest_folder)
    imap.store(sid, '+FLAGS', '\\Deleted')
    imap.expunge()

-- otherwise, if you know the way to move it directly, it shouldn't change.



来源:https://stackoverflow.com/questions/3615561/about-imap-uid-with-imaplib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!