@Override
 public void setEncoding(String encoding) throws MessagingException {
   if (!MimeUtil.ENC_7BIT.equalsIgnoreCase(encoding)
       && !MimeUtil.ENC_8BIT.equalsIgnoreCase(encoding)) {
     throw new MessagingException(
         "Incompatible content-transfer-encoding applied to a CompositeBody");
   }
   mEncoding = encoding;
 }
 @Override
 public void setUsing7bitTransport() throws MessagingException {
   String type = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE);
   /*
    * We don't trust that a multipart/* will properly have an 8bit encoding
    * header if any of its subparts are 8bit, so we automatically recurse
    * (as long as its not multipart/signed).
    */
   if (mBody instanceof CompositeBody && !MimeUtility.isSameMimeType(type, "multipart/signed")) {
     setEncoding(MimeUtil.ENC_7BIT);
     // recurse
     ((CompositeBody) mBody).setUsing7bitTransport();
   } else if (!MimeUtil.ENC_8BIT.equalsIgnoreCase(
       getFirstHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING))) {
     return;
   } else if (type != null
       && (MimeUtility.isSameMimeType(type, "multipart/signed") || MimeUtility.isMessage(type))) {
     /*
      * This shouldn't happen. In any case, it would be wrong to convert
      * them to some other encoding for 7bit transport.
      *
      * RFC 1847 says multipart/signed must be 7bit. It also says their
      * bodies must be treated as opaque, so we must not change the
      * encoding.
      *
      * We've dealt with (CompositeBody) type message/rfc822 above. Here
      * we must deal with all other message/* types. RFC 2045 says
      * message/* can only be 7bit or 8bit. RFC 2046 says unknown
      * message/* types must be treated as application/octet-stream,
      * which means we can't recurse into them. It also says that
      * existing subtypes message/partial and message/external must only
      * be 7bit, and that future subtypes "should be" 7bit.
      */
     throw new MessagingException("Unable to convert 8bit body part to 7bit");
   } else {
     setEncoding(MimeUtil.ENC_QUOTED_PRINTABLE);
   }
 }