Gmail API decoding messages in Javascript

后端 未结 7 991
暖寄归人
暖寄归人 2020-12-30 11:07

I am having serious problems decoding the message body of the emails I get using the Gmail API. I want to grab the message content and put the content in a div. I am using a

7条回答
  •  北海茫月
    2020-12-30 11:42

    Here is the solution: Gmail API - "Users.messages: get" method has in response message.payload.body.data parted base64 data, it's separated by "-" symbol. It's not entire base64 encoded text, it's parts of base64 text. You have to try to decode every single part of this or make one mono string by unite and replace "-" symbol. After this you can easily decode it to human text. You can manually check every part here https://www.base64decode.org

提交回复
热议问题