gmail.js
gmail.js copied to clipboard
Get attachment content from email data
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?
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.
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?
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.
Old issue is old. Closing.