MIME 电子邮件的 Base64 解码不起作用(GMail API) [英] Base64 decoding of MIME email not working (GMail API)

查看:47
本文介绍了MIME 电子邮件的 Base64 解码不起作用(GMail API)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 GMail API 来检索电子邮件内容.我正在为正文获取以下 base64 编码数据:http://hastebin.com/ovucoranam.md

I'm using the GMail API to retrieve an email contents. I am getting the following base64 encoded data for the body: http://hastebin.com/ovucoranam.md

但是当我通过 base64 解码器运行它时,它要么返回一个空字符串(错误),要么返回类似于 HTML 数据但带有一堆奇怪字符的东西.

But when I run it through a base64 decoder, it either returns an empty string (error) or something that resembles the HTML data but with a bunch of weird characters.

帮助?

推荐答案

我不确定你是否已经解决了它,但 GmailGuy 是正确的.您需要将正文转换为 Base64 RFC 4648 标准.要点是您需要将 - 替换为 +,将 _ 替换为 /.

I'm not sure if you've solved it yet, but GmailGuy is correct. You need to convert the body to the Base64 RFC 4648 standard. The jist is you'll need to replace - with + and _ with /.

我已经采纳了您的原始意见并进行了替换:http://hastebin.com/ukanavudaz

I've taken your original input and did the replacement: http://hastebin.com/ukanavudaz

然后用 base64decode.org 解码,没问题.

And used base64decode.org to decode it, and it was fine.

这篇关于MIME 电子邮件的 Base64 解码不起作用(GMail API)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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