title: Gmail API insert message throws - Bad Request (400)
body: <p>Trying to insert message loaded from MimeMessage (as shown in gmail api example), some 
  messages are passing fine, but some throws this:</p>
  
  <pre><code>    com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
  &lt;HTML&gt;
  &lt;HEAD&gt;
  &lt;TITLE&gt;Bad Request&lt;/TITLE&gt;
  &lt;/HEAD&gt;
  &lt;BODY BGCOLOR="#FFFFFF" TEXT="#000000"&gt;
  &lt;H1&gt;Bad Request&lt;/H1&gt;
  &lt;H2&gt;Error 400&lt;/H2&gt;
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  
      at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
      at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
      at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
      at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)
      at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1049)
      at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
      at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
      at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
  </code></pre>
  
  <p>The code is next:</p>
  
  <pre><code>     final ByteArrayOutputStream baos = new ByteArrayOutputStream();
       mime.writeTo(baos);
       String encodedEmail = Base64.encodeBase64URLSafeString(baos.toByteArray());
       tmpMail = new Message();
       tmpMail.setRaw(encodedEmail);
       client.users().messages().insert(this.taskInfo.getTargetAccount(), tmpMail).execute();
  </code></pre>
  
  <p>Without any other information, what could be a possible reason for that error ?</p>
  
  <p>Thanks.</p>
  
  <p><strong>UPD. Looks like messages larger than 10Mb are giving this error. Google guys, can you advise ? Thanks</strong></p>