private void buildAttachments() throws MessagingException, EmailException {
	MimeMultipart container = this.getContainer();
	MimeMultipart subContainer = null;
	MimeMultipart subContainerHTML = new MimeMultipart("related");
	BodyPart msgHtml = null;
	BodyPart msgText = null;

	container.setSubType("mixed");
	subContainer = new MimeMultipart("alternative");

	if (!StringUtil.isEmpty(this.text)) {
	    msgText = new MimeBodyPart();
	    subContainer.addBodyPart(msgText);

	    if (!StringUtil.isEmpty(this.charset)) {
		msgText.setContent(this.text, Email.TEXT_PLAIN + "; charset=" + this.charset);
	    }
	    else {
		msgText.setContent(this.text, Email.TEXT_PLAIN);
	    }
	}

	if (!StringUtil.isEmpty(this.html)) {
	    if (this.inlineImages.size() > 0) {
		msgHtml = new MimeBodyPart();
		subContainerHTML.addBodyPart(msgHtml);
	    }
	    else {
		msgHtml = new MimeBodyPart();
		subContainer.addBodyPart(msgHtml);
	    }

	    if (!StringUtil.isEmpty(this.charset)) {
		msgHtml.setContent(this.html, Email.TEXT_HTML + "; charset=" + this.charset);
	    }
	    else {
		msgHtml.setContent(this.html, Email.TEXT_HTML);
	    }

	    Iterator iter = this.inlineImages.iterator();
	    while (iter.hasNext()) {
		subContainerHTML.addBodyPart((BodyPart) iter.next());
	    }
	}

	// add sub containers to message
	this.addPart(subContainer, 0);

	if (this.inlineImages.size() > 0) {
	    // add sub container to message
	    this.addPart(subContainerHTML, 1);
	}
    }
private void buildAttachments ( ) throws MessagingException , EmailException { MimeMultipart container = this . getContainer ( ) ; MimeMultipart subContainer = null ; MimeMultipart subContainerHTML = new MimeMultipart ( "related" ) ; BodyPart msgHtml = null ; BodyPart msgText = null ; container . setSubType ( "mixed" ) ; subContainer = new MimeMultipart ( "alternative" ) ; if ( ! StringUtil . isEmpty ( this . text ) ) { msgText = new MimeBodyPart ( ) ; subContainer . addBodyPart ( msgText ) ; if ( ! StringUtil . isEmpty ( this . charset ) ) { msgText . setContent ( this . text , Email . TEXT_PLAIN + "; charset=" + this . charset ) ; } else { msgText . setContent ( this . text , Email . TEXT_PLAIN ) ; } } if ( ! StringUtil . isEmpty ( this . html ) ) { if ( this . inlineImages . size ( ) > 0 ) { msgHtml = new MimeBodyPart ( ) ; subContainerHTML . addBodyPart ( msgHtml ) ; } else { msgHtml = new MimeBodyPart ( ) ; subContainer . addBodyPart ( msgHtml ) ; } if ( ! StringUtil . isEmpty ( this . charset ) ) { msgHtml . setContent ( this . html , Email . TEXT_HTML + "; charset=" + this . charset ) ; } else { msgHtml . setContent ( this . html , Email . TEXT_HTML ) ; } Iterator iter = this . inlineImages . iterator ( ) ; while ( iter . hasNext ( ) ) { subContainerHTML . addBodyPart ( ( BodyPart ) iter . next ( ) ) ; } } this . addPart ( subContainer , 0 ) ; if ( this . inlineImages . size ( ) > 0 ) { this . addPart ( subContainerHTML , 1 ) ; } }
@throws EmailException EmailException
@throws MessagingException MessagingException