Gmail API - Parse message content (Base64 decoding?) with Javascript

前端 未结 4 768
野的像风
野的像风 2020-12-14 13:15

I\'m trying to use the Gmail API to get a user\'s email, grab the message subject and body, and then display it on a webpage. I\'ll be doing other stuff with it, but this is

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 13:35

    Ah! I figured it out. parts is an array, so I should have been calling it like: gapi.client.gmail.users.messages.get({'id': }).payload.parts[0].body.data

    Now my problem is decoding the emails, which is proving successful in plain text emails, but failing in emails from non-personal locations (businesses, social media update emails, etc.). But I'll make a new question to get answers for that.

提交回复
热议问题