gmail.js icon indicating copy to clipboard operation
gmail.js copied to clipboard

Get attachment content from email data

Open SanketDG opened this issue 6 years ago • 3 comments

I am trying to get plain text content of the attachments present in a email.

I don't see the attachment content anywhere in the email data, but I assume the attachment url is present, which needs to be used to fetch the attachment body.

I have tried the following:

  • Using gmail.tools.make_request_download_promise()
  • Using fetch

Since these are unauthenticated, they do not get me the attachment content.

How can I get the attachment content?

SanketDG avatar Jun 26 '19 10:06 SanketDG

I’m not sure what your issue is.

I’m doing exactly what you’re saying (using XHR to download attachments from the API-provided attachment URLs) in a production extension, and that works for me.

Please note: I’m doing everything in regular JS-context, not in a content-script nor in a background-page.

josteink avatar Jun 27 '19 18:06 josteink

Can you provide some sample code to download the attachments using the attachment URLS using XHR, I am doing a simple GET and I am not able to do so. Am I missing some extra headers or params?

SanketDG avatar Jun 28 '19 09:06 SanketDG

I’m on vacation now and can’t really help much.

I might be able to identify some errors if you can show a minimum proof of concept of what you’re trying to do (like a working repo) and what goes wrong though.

josteink avatar Jun 28 '19 15:06 josteink

Old issue is old. Closing.

josteink avatar Oct 11 '23 08:10 josteink