如何从已发送的邮件中获取 Gmail 对话的 URL?
我正在使用 Chrome 插件将 Gmail 与任务管理器集成。我想要获取用户刚刚添加邮件的 Gmail 对话的链接,并关联相关任务。每个 Gmail 对话都有一个与之关联的 URL,当用户阅读对话时,它位于地址栏中。如果用户收到电子邮件并做出回复,则该 URL 就位于地址栏中。
但是,如果用户撰写新消息(不是响应现有线程),我知道查找结果对话的 URL 的唯一方法是进入“已发送邮件”并单击已发送的消息。
考虑到 Gmail 的所有 API(IMAP、小工具、页面上的 Chrome 扩展),并且考虑到用户刚刚在新邮件上单击“发送”,是否有一种方法可以以编程方式获取结果对话的 URL?
I'm integrating Gmail with a task manager using a Chrome plugin. I'd like to get a link to the Gmail conversation a user has just added a message to and associate a relevant task. Every Gmail conversation has a URL associated with it, and it's in the address bar when the user is reading the conversation. If the user gets an email and then responds to it, the URL is right there in the address bar.
However, if a user composes a new message (not in response to an existing thread), the only way I know of to find the URL for the resulting conversation is to go into Sent Mail and click on the sent message.
Given all of Gmail's APIs (IMAP, gadgets, a Chrome extension poking around on the page), and given that the user has just clicked "Send" on a new message, is there a way to programmatically get the URL of the resulting conversation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能不是解决此问题的最佳方法,但如果您可以检测(通过轮询等)何时显示小警报栏,
并检查是否是“电子邮件已发送”消息(即其中存在查看消息链接),然后该链接上有一个名为
的 DOM 属性(实际上是一个跨度) param
包含新对话的唯一 ID。您可以将其附加到
https://mail.google.com/mail/#sent/
,然后您将获得该对话的唯一网址。Probably not the best way of going about this, but if you can detect (via polling, etc.) when the little alert bar shows up,
and check whether it is the "email sent" message (i.e. the View message link exists inside it), then there is a DOM attribute on the link (which is really a span) called
param
which contains a unique ID for the new conversation.You can append that to
https://mail.google.com/mail/#sent/
and you'll have a unique URL for that conversation.