Having trouble reading the text/html message part

后端 未结 3 1783
生来不讨喜
生来不讨喜 2021-01-02 03:11

I\'m trying to pull out the subject and body of an email with .Net. It seems to go OK except for the text/html MessagePart. I\'m not sure of the encoding etc - has anybody

3条回答
  •  滥情空心
    2021-01-02 03:17

    On this page https://developers.google.com/gmail/api/v1/reference/users/messages/attachments/get

    you can find that there is a .NET example with this code for decoding:

    // Converting from RFC 4648 base64-encoding
    // see http://en.wikipedia.org/wiki/Base64#Implementations_and_history
    String attachData = attachPart.Data.Replace('-', '+');
    attachData = attachData.Replace('_', '/');
    byte[] data = Convert.FromBase64String(attachData);
    

提交回复
热议问题