0

I want to manage my gmail use Gmail api.

I get list mails success but when I read detail of mail some mail is error image url in content.

My code here:

var mailRequest = service.Users.Messages.Get("me", mailId);
mailRequest.Format = UsersResource.MessagesResource.GetRequest.FormatEnum.Full;

var message = mailRequest.Execute();

// Get body email
var body = (!string.IsNullOrEmpty(message.Payload.Body.Data) ? message.Payload.Body.Data : message.Payload.Parts[1].Body.Data);
if (!string.IsNullOrEmpty(body))
{
  body = body.Replace("-", "+");
  body = body.Replace("_", "/");
  var data = Convert.FromBase64String(body);
  body = Encoding.UTF8.GetString(data);
}

How fixed it? Please help me! Thanks you so much.

Tholle
  • 108,070
  • 19
  • 198
  • 189
Huan Ho
  • 145
  • 2
  • 9
  • [This answer](http://stackoverflow.com/questions/32655874/cannot-get-the-body-of-email-with-gmail-php-api/32660892#32660892) explains what can go wrong. It is an answer to a PHP question, but maybe you can get some inspiration from it. – Tholle Aug 13 '16 at 11:03
  • Gmail api messages list return nextPageToken to get the next page list. I want to go previous page. How can I do that? – Huan Ho Aug 17 '16 at 13:31

0 Answers0