I am able to create simple html-only drafts using the GMail API.
But when I try to upload attachments it fails with the following error :
{
\"code\
I think that code is reasonable. Can you provide the output from the email.writeTo(System.out) to confirm? Seems like a bug in the Gmail API.
Is this repeatable for any specific user? (Does it always fail or will it eventually work?)
Does it happen for all users or only certain users (e.g. does it work for gmail.com users and not for Google Apps users)?
Try this hope so its works first put text content and after that html content its display properly
MimeBodyPart textPart = new MimeBodyPart();
textPart.setText("This is actual message", "utf-8");
MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setContent("<h1>This is a test</h1>"
+ "<img src=\"http://www.rgagnon.com/images/jht.gif\">", "text/html; charset=utf-8");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(textPart);<--first
multipart.addBodyPart(htmlPart);<--seocnd
message.setContent(multipart)
Problem solved by itself the next day ! I don't know if the GMail API team fixed something or if it was a temporary bug.