Gmail 中各个邮件的链接
我想下载 gmail 帐户中的所有电子邮件,并且还想获得唯一的 url,它将在 gmail 中打开确切的邮件,当然需要身份验证。我尝试使用 javax.mail imap 库,但 Imap 可能不支持类似的东西。
我可以使用“https://mail.google.com/mail/feed/atom”gmail feed。但不会给我完整的电子邮件,它只提供未读的电子邮件,我不想错过任何电子邮件
I want to download all emails in a gmail account and also want to get the unique url which will open the exact mail in gmail, off course with authentication. I tried using javax.mail imap library but Imap probably doesn't supports anything like it.
I can use "https://mail.google.com/mail/feed/atom" gmail feeds. but won't give me entire email and it only gives unread email and I don't want to miss any email
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
https://mail.google.com/mail/#all/HexEncodeMessageID
将 HexEncodeMessageID 部分替换为 ID。当您在新窗口中打开电子邮件时(使用右上角的弹出图标),您就会得到它。
ID 如下所示:search=inbox&th=1426b8f59e003aa0
https://mail.google.com/mail/#all/HexEncodeMessageID
replace the HexEncodeMessageID part with the ID. You get it, when you open the email in a new window (use the pop out icon in the upper right corner.
The id looks like this: search=inbox&th=1426b8f59e003aa0
我相当确信这是不可能的 - 没有可靠的方法来获取可指向 Gmail 中的单个电子邮件的唯一 URL。我很想听听别的!
我确实相信可以获取一个 URL,该 URL 将引导至包含该消息的 Gmail 线程,但您无法控制在此线程显示中“展开”哪些消息。
I'm fairly confident this is not possible - that there is no reliable way to get the unique URL that'll lead to a single email in Gmail. I'd love to hear otherwise!
I do believe it is possible to get a URL that will lead to the Gmail thread containing the message - but you have no control over which message(s) are "expanded" in this threaded display.
如果您使用的是 Google Apps for Business/Education,则可以执行此操作。如果是,您可以使用 OAuth 访问 Gmail 收件箱 Feed (Atom)。 OAuth 还可用于通过 IMAP 访问 Gmail - 然后您可以通过编程方式完全访问 IMAP 服务器,请参阅 Gmail IMAP 和使用 OAuth 的 SMTP。
Google 扩展了 IMAP,允许开发者通过 IMAP 提供更像 Gmail 的体验,请参阅:(Gmail IMAP 扩展、X- GM-EXT-1)。
唯一消息 (X-GM-MSGID) 和唯一线程 (X-GM-THRID) id 可用于直接生成 Gmail 消息的链接 - 您只需对 id long 进行十六进制编码(例如 Long.toHexString(x_gm_msgId)) 。然后,您的链接需要采用以下形式:
提供ACCOUNT_ID_HERE(类似于[电子邮件受保护])和MESSAGE_ID_HERE(视情况而定)。
我一直在这个领域工作,认为您可能会发现我的项目很有用,请参阅:java-gmail-imap。
[注意:上述格式的 URL 不适用于 Gmail 的移动网站(至少在 iPhone/Safari 上)。]
You can do this if you are using Google Apps for Business/Education. If you are, you can access the Gmail inbox feed (Atom) by using OAuth. OAuth can also be used to access Gmail via IMAP - you can then have complete access to the IMAP server programmatically, see Gmail IMAP and SMTP using OAuth.
Google has extended IMAP to allow developers to provide a more Gmail-like experience via IMAP, see: (Gmail IMAP Extensions, X-GM-EXT-1).
The unique message (X-GM-MSGID) and unique thread (X-GM-THRID) ids can be used to produce links to Gmail messages directly - you just have to hex encode the id long (e.g. Long.toHexString(x_gm_msgId)). Your link will then need need to be in the form of:
supplying ACCOUNT_ID_HERE (something like [email protected]) and MESSAGE_ID_HERE as appropriate.
I have been working in this area and think you might find my project useful, see: java-gmail-imap.
[NB: URLs formatted as above do not work on Gmail's mobile site (at least on iPhone/Safari).]