生成Gmail附件网址以进行查看 [英] Generate gmail-attachment url to view

查看:76
本文介绍了生成Gmail附件网址以进行查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究可以访问g-mail中所有图片的项目.我尝试使用可以获取所有必需附件的节点使用G-mail API,但这需要下载整个图像.我可以访问使用API​​的附件ID和消息ID.是否有任何方法可以生成附件的URL(以供查看),以便我可以提供指向项目中所需图像的链接.

I'm working on project which can access all the pictures in g-mail.I've tried the G-mail API using node which can fetch all required attachments.But that requires to download the whole image.I can access the attachment id and message id using the API.Is there any way to generate the url of attachment (to view) so that i can provide a link to the required image from my project.

推荐答案

我实际上发现了这个相关问题,

I actually found this related issue, Issue #134, and you may want to try the suggested solution.

您可以使用以下方法获取电子邮件附件:

You may fetch email attachments using this:

https://mail.google.com/mail/u/0/?ui=2&ik= {ik_value}& view = att& th = {message_id}&d = 0.{atachment_index}& disp = safe& zw

其中, attachmment_index 只是附件的索引.如果有3个附件,而您想获取第3个文件,则索引值为 3 .此URL是302标头,起下载文件的链接缩短器的作用.打开此链接将带您进入附件数据

wherein, attachmment_index is just the index of the attachment. If there are 3 attachments and you want to get the 3rd file, the index value will be 3. This URL is a 302 header that acts like a link shortener for the download file. Opening this link will lead you to the attachment data

var ik = gmail.tracker.ik;
var id = gmail.get.email_id();
var aid = "1"; // gets the first attachment

var url = "https://mail.google.com/mail/u/0/?ui=2&ik=" + ik + "&view=att&th=" + id + "&attid=0." + aid + "&disp=safe&zw";

console.log(url);

这篇关于生成Gmail附件网址以进行查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆