Find Gmail url-IDs via IMAP

后端 未结 9 978
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 16:02

One of my favourite features of Gmail is the ability to bookmark urls to certain messages like this:

https://mail.google.com/mail/#all/124c8f386d41fd3a

What

9条回答
  •  自闭症患者
    2020-12-07 16:22

    This seems to be something internal to GMail's web UI. I can imagine a workaround like this:

    • log in to GMail using the basic HTML mode, and grab the session cookie
    • use curl, wget or anything similar with this session cookie to fetch the page

      https://mail.google.com/mail/h?s=q&q=2AE41111.1234123@gmail.com

    where the thing after the 'q=' part is the Message-ID of the e-mail from IMAP.

    Now you can scrape the "GMail ID" of the message you need from the HTML, search for a link with a target URL that looks like this:

    ?v=c&s=q&q=2AE41111.1234123%40gmail.com&th=124ae57b77769275

    The part after the 'th' is what you need.

    Nasty, probably very inefficient, but this may very well be the closest you get to a solution.

    If you are not that desperate, you can use the search URL, which, in its most simple form, and using the standard UI, looks like this:

    https://mail.google.com/mail/#search/2AE41111.1234123@gmail.com
    

    The last part is the value of the Message-ID header field again. This way, you get a single search result, but you still have to click on it to view.

提交回复
热议问题