I am using the Python API for Gmail. I request some messages and receive them correctly, but the message body looks like complete nonsense, even if the MIME type is specified as text/plainor text/html.
I searched all the API docs, but they keep saying this as a string, when obviously there should be some encoding ... I thought it could be an encoding base64, but trying to decode it using Python base64gives me TypeError: Incorrect padding, so either it is not base64, or I badly decode.
I would like to provide a good example, but since I process confidential information, I will have to confuse it a bit ...
{
"payload": {
"mimeType": "multipart/mixed",
"filename": "",
"headers": [
...
],
"body": {
"size": 0
},
"parts": [
{
"mimeType": "multipart/alternative",
"filename": "",
"headers": [
{
"name": "Content-Type",
"value": "multipart/alternative; boundary=001a1140b160adc309053bd7ec57"
}
],
"body": {
"size": 0
},
"parts": [
{
"partId": "0.0",
"mimeType": "text/plain",
"filename": "",
"headers": [
{
"name": "Content-Type",
"value": "text/plain; charset=UTF-8"
},
{
"name": "Content-Transfer-Encoding",
"value": "quoted-printable"
}
],
"body": {
"size": 4067,
"data": "LS0tLS0tLS0tLSBGb3J3YXJkZWQgbWVzc2FnZSAtLS0tLS0tLS0tDQpGcm9tOiBMaW5rZWRJbiA8am9iLWFwcHNAbGlua2VkaW4uY29tPg0KRGF0ZTogU2F0LCBTZXAgMywgMjAxNiBhdCA5OjMwIEFNDQpTdWJqZWN0OiBBcHBsaWNhdGlvbiBmb3IgU2VuaW9yIEJhY2tlbmQgRGV2ZWxvcG..."
}
, , payload.parts[0].parts[0].body.data. , , , ... ?
, , base64 ( MIME?).
: , , - . 5 , , , . , . !