Search code examples
pythonpython-3.ximap

Getting a direct link to an email


I am making an app where the user can search through his/her email, using certain keywords, made with python and imap lib, but I cant figure how to open the mail the user want in the web browser, considering the user has already logged in. Is there a way to do it ?

Thanks.

EDIT: What Iam looking for is a way to get the link of the email(Gmail to be specific), that imap has "parsed"


Solution

  • import webbrowser
    webbrowser.open('https://mail.google.com/mail/u/0/#search/rfc822msgid: <MESSAGE_ID>')
    

    The Message Id is located within the Email headers. https://stackoverflow.com/a/48014199/