开发者

How can I uniquely identify an IMAP message after copying it?

I want to move an IMAP message from INBOX to INBOX/Archive using python's imapclient library, which I'm doing basically like this:

def archive_message(imap, message_id):
    imap.copy([message_id], getOptions().imap_archive_folder)
    imap.delete_messages([message_id])

However, this loses my reference to the message. What I want to do is to store an identifier for the message that will allow me to look up the message later, using something like this:

def retrieve_message(imap, MYSTIC开发者_如何学编程AL_STORED_ID):
    imap.select_folder(getOptions().imap_archive_folder)
    return imap.fetch([MYSTICAL_STORED_ID], parts=["RFC822"])

What ID should I / can I use for this, and how would I do the lookup part of this?


The value in the Message-Id header is supposed to be unique per email message.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜