0

I'm using smtplib in python to send emails. I want to fetch any replies to these emails. Does imaplibprovide option to search inbox emails using message id of the parent email? I'm sure it does because that's how email clients like outlook etc. get it done.

I want to do something like the code below -

result, data = mail.fetch(None, f'(PARENT-MESSAGE-ID "{parent_msg_id}")')

How can I achieve this?

martineau
  • 119,623
  • 25
  • 170
  • 301
GrozaFry
  • 41
  • 7
  • 2
    Surprisingly, not directly (unless your server has the THREADING extension). You can search HEADER references and in-reply-to for your parent message ID. Conventional clients tend to download the headers or metadata for all messages and do the threading client side when using IMAP or POP. – Max Jul 13 '22 at 17:22
  • Possible duplicate of https://stackoverflow.com/questions/3879265/how-to-use-thread-search-method-in-imaplib – tripleee Jul 14 '22 at 07:59

0 Answers0