gpt4 book ai didi

javascript - 从 chrome 扩展程序访问 Gmail 附件?

转载 作者:行者123 更新时间:2023-11-29 20:15:38 25 4
gpt4 key购买 nike

您好,我正在尝试编写一个需要在电子邮件附件(纯文本)中读取的 chrome 扩展。我觉得这应该是可能的,因为 gmail 给你一个下载链接,但它不是直接链接,这是否不可能?

我有以下代码来读取不适用于 gmail 的远程文件:

<script>
var txtFile = new XMLHttpRequest();
txtFile.open("GET", "http://remote.com/remote_file", true);
txtFile.onreadystatechange = function() {
if (txtFile.readyState === 4) { // Makes sure the document is ready to parse.
if (txtFile.status === 200) { // Makes sure it's found the file.

allText = txtFile.responseText;
lines = txtFile.responseText.split("\n"); // Will separate each line into an array
alert(allText)
}
}
}
txtFile.send(null);
</script>

有人知道我如何阅读这样的 gmail 附件吗?谢谢

最佳答案

Gmail 有一个指向原始电子邮件源的链接(菜单中的“显示原始”)。不确定是否可以通过编程方式读取它,但如果可以,我会尝试解析原始消息源并从那里获取附件(我相信它们是 base64 编码的)。

关于javascript - 从 chrome 扩展程序访问 Gmail 附件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7047053/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com