I'm looking for a way to figure out how to get the thread id for a particular email on Gmail, just before it is sent OR at the point where the send button is clicked.
我正在寻找一种方法来弄清楚如何获取Gmail上特定电子邮件的线程ID,就在它发送之前或在点击发送按钮的位置。
Currently, I'm working with Javascript in order to scrape other items off the email and store them in a record which works pretty well for everything except the thread id.
目前,我正在使用Javascript来从电子邮件中删除其他项目并将它们存储在记录中,该记录对于除了线程ID之外的所有内容都非常有效。
The thread ID can be found after I send the email within the URL:
我在URL中发送电子邮件后可以找到线程ID:
https://mail.google.com/mail/u/0/?shva=1#inbox/13ddda647539dcca
In this case, the thread id (if I'm right - is 13ddda647539dcca.
在这种情况下,线程ID(如果我是对的 - 是13ddda647539dcca。
Any help would be appreciated.
任何帮助,将不胜感激。
2 个解决方案
#1
0
You could try:
你可以尝试:
var matched = window.location.hash.match(/[A-Za-z0-9]+$/);
if (matched) {
// Found alphanumeric string at end of hash
}
And you can get the value with matched[0]
.
并且您可以使用匹配的[0]获取值。
window.location.hash
should only grab the "#inbox/13ddda647539dcca" part. Then the regex is to match against any alphanumeric characters at the end of the string. So the fact that "inbox" is separated from the thread id by a "/" is important.
window.location.hash应该只抓取“#inbox / 13ddda647539dcca”部分。然后正则表达式匹配字符串末尾的任何字母数字字符。因此,“收件箱”与线程ID通过“/”分隔的事实很重要。
Of course, all of this depends on the reliability of Gmail keeping the URL following the same convention as it currently seems to be.
当然,所有这些都取决于Gmail保持URL的可靠性,遵循与目前相同的惯例。
#2
4
If anyone is still interested - You can retrieve the thread id after the email is sent by observing the that appears at the top of the page. This span contains a link which has an attribute named 'param' which has the thread-id.
如果有人仍然感兴趣 - 您可以通过观察页面顶部显示的电子邮件来检索电子邮件ID。此span包含一个链接,该链接具有名为'param'的属性,该属性具有thread-id。
#1
0
You could try:
你可以尝试:
var matched = window.location.hash.match(/[A-Za-z0-9]+$/);
if (matched) {
// Found alphanumeric string at end of hash
}
And you can get the value with matched[0]
.
并且您可以使用匹配的[0]获取值。
window.location.hash
should only grab the "#inbox/13ddda647539dcca" part. Then the regex is to match against any alphanumeric characters at the end of the string. So the fact that "inbox" is separated from the thread id by a "/" is important.
window.location.hash应该只抓取“#inbox / 13ddda647539dcca”部分。然后正则表达式匹配字符串末尾的任何字母数字字符。因此,“收件箱”与线程ID通过“/”分隔的事实很重要。
Of course, all of this depends on the reliability of Gmail keeping the URL following the same convention as it currently seems to be.
当然,所有这些都取决于Gmail保持URL的可靠性,遵循与目前相同的惯例。
#2
4
If anyone is still interested - You can retrieve the thread id after the email is sent by observing the that appears at the top of the page. This span contains a link which has an attribute named 'param' which has the thread-id.
如果有人仍然感兴趣 - 您可以通过观察页面顶部显示的电子邮件来检索电子邮件ID。此span包含一个链接,该链接具有名为'param'的属性,该属性具有thread-id。