System.out.println( "HTML = text/html : " + htmlPart.isMimeType( "text/html" ) ); System.out.println( "HTML Content Type: " + htmlPart.getContentType() ); System.out.println( "TEXT = text/plain: " + textPart.isMimeType( "text/plain" ) ); System.out.println( "HTML = text/html : " + htmlPart.isMimeType( "text/html" ) ); System.out.println( "HTML Content Type: " + htmlPart.getContentType() ); System.out.println( "HTML Data Handler: " + htmlPart.getDataHandler().getContentType() );
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @exception MessagingException for failures */ public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @param mimeType the MIME type to check * @return true if it matches the MIME type * @exception MessagingException for failures */ public boolean isMimeType(String mimeType) throws MessagingException { return MimeBodyPart.isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @param mimeType the MIME type to check * @return true if it matches the MIME type * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return MimeBodyPart.isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. */ public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. */ public boolean isMimeType(String mimeType) throws MessagingException { return MimeBodyPart.isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. */ public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. */ public boolean isMimeType(String mimeType) throws MessagingException { return MimeBodyPart.isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @param mimeType the MIME type to check * @return true if it matches the MIME type * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return MimeBodyPart.isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @param mimeType the MIME type to check * @return true if it matches the MIME type * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return MimeBodyPart.isMimeType(this, mimeType); }
/** * Is this Part of the specified MIME type? This method * compares <strong>only the <code>primaryType</code> and * <code>subType</code></strong>. * The parameters of the content types are ignored. <p> * * For example, this method will return <code>true</code> when * comparing a Part of content type <strong>"text/plain"</strong> * with <strong>"text/plain; charset=foobar"</strong>. <p> * * If the <code>subType</code> of <code>mimeType</code> is the * special character '*', then the subtype is ignored during the * comparison. * * @param mimeType the MIME type to check * @return true if it matches the MIME type * @exception MessagingException for failures */ @Override public boolean isMimeType(String mimeType) throws MessagingException { return MimeBodyPart.isMimeType(this, mimeType); }
MimeBodyPart mbp = (MimeBodyPart)part; if (mbp.isMimeType("text/plain")) { body += mbp.getContent().toString(); } else if (mbp.isMimeType("TEXT/HTML")) { body += mbp.getContent().toString(); }else if(mbp.isMimeType("text/xml")) { body += mbp.getContent().toString(); }
if( mimeMessage.getContent() instanceof Multipart) { Multipart multipartContent = (Multipart) mimeMessage.getContent(); List<BodyPart> deleteThese = new ArrayList<BodyPart>(); for( int i = 0; i < multipartContent.getCount(); i++ ) { MimeBodyPart part = (MimeBodyPart) multipartContent.getBodyPart(i); String disposition = part.getDisposition(); if( disposition != null && ( disposition.equalsIgnoreCase( Part.ATTACHMENT ) || ( disposition.equalsIgnoreCase( Part.INLINE ) && !part.isMimeType( PLAIN_TEXT_MIME_TYPE ) && !part.isMimeType( HTML_MIME_TYPE ) ) ) ) { // do something with part } }