@Test public void testSetHtmlBody() throws MessagingException, IOException { final String htmlBody = "this is the html body"; MimeMessage msg = sut.createMessage(); Multipart content = (Multipart) msg.getContent(); assertEquals(0, content.getCount()); sut.setHtmlBody(msg, htmlBody); assertEquals(1, content.getCount()); BodyPart part = content.getBodyPart(0); assertEquals(htmlBody, part.getContent().toString()); assertEquals("text/html; charset=ISO-8859-1", part.getContentType()); }
public void setHtmlBody(final MimeMessage message, final String htmlBody) throws MessagingException { BodyPart htmlBp = new MimeBodyPart(); htmlBp.setContent(htmlBody, "text/html"); htmlBp.setHeader("MIME-VERSION", "1.0"); htmlBp.setHeader("Content-Type", "text/html; charset=ISO-8859-1"); getMultipartAlternative(message).addBodyPart(htmlBp); }
EmailerFactory { public void setHtmlBody(final MimeMessage message, final String htmlBody) throws MessagingException { BodyPart htmlBp = new MimeBodyPart(); htmlBp.setContent(htmlBody, "text/html"); htmlBp.setHeader("MIME-VERSION", "1.0"); htmlBp.setHeader("Content-Type", "text/html; charset=ISO-8859-1"); getMultipartAlternative(message).addBodyPart(htmlBp); } }
EmailerFactory { public void setHtmlBody(final MimeMessage message, final String htmlBody) throws MessagingException { BodyPart htmlBp = new MimeBodyPart(); htmlBp.setContent(htmlBody, "text/html"); htmlBp.setHeader("MIME-VERSION", "1.0"); htmlBp.setHeader("Content-Type", "text/html; charset=ISO-8859-1"); getMultipartAlternative(message).addBodyPart(htmlBp); } EmailerFactory(final String inMailTransportProtocol, final Map<String, String> inTransportConfiguration,
            final String inDefaultFromAddress); }
EmailerFactory { public void setHtmlBody(final MimeMessage message, final String htmlBody) throws MessagingException { BodyPart htmlBp = new MimeBodyPart(); htmlBp.setContent(htmlBody, "text/html"); htmlBp.setHeader("MIME-VERSION", "1.0"); htmlBp.setHeader("Content-Type", "text/html; charset=ISO-8859-1"); getMultipartAlternative(message).addBodyPart(htmlBp); } EmailerFactory(final String inMailTransportProtocol, final Map<String, String> inTransportConfiguration,
            final String inDefaultFromAddress); static String buildEmailList(final Iterable< ? extends HasEmail> list); void sendMail(final Message message); MimeMessage createMessage(); void setTo(final MimeMessage message, final String emailToString); void setCc(final MimeMessage message, final String emailToString); void setBcc(final MimeMessage message, final String emailToString); void setFrom(final MimeMessage message, final String emailFromString); void setReplyTo(final MimeMessage message, final String addressString); void setSubject(final MimeMessage message, final String subject); void setTextBody(final MimeMessage message, final String textBody); void setHtmlBody(final MimeMessage message, final String htmlBody); Part addAttachmentPart(final Message message); Part addAttachmentMessage(final Message message, final Message attachedMessage); }
EmailerFactory { public void setHtmlBody(final MimeMessage message, final String htmlBody) throws MessagingException { BodyPart htmlBp = new MimeBodyPart(); htmlBp.setContent(htmlBody, "text/html"); htmlBp.setHeader("MIME-VERSION", "1.0"); htmlBp.setHeader("Content-Type", "text/html; charset=ISO-8859-1"); getMultipartAlternative(message).addBodyPart(htmlBp); } EmailerFactory(final String inMailTransportProtocol, final Map<String, String> inTransportConfiguration,
            final String inDefaultFromAddress); static String buildEmailList(final Iterable< ? extends HasEmail> list); void sendMail(final Message message); MimeMessage createMessage(); void setTo(final MimeMessage message, final String emailToString); void setCc(final MimeMessage message, final String emailToString); void setBcc(final MimeMessage message, final String emailToString); void setFrom(final MimeMessage message, final String emailFromString); void setReplyTo(final MimeMessage message, final String addressString); void setSubject(final MimeMessage message, final String subject); void setTextBody(final MimeMessage message, final String textBody); void setHtmlBody(final MimeMessage message, final String htmlBody); Part addAttachmentPart(final Message message); Part addAttachmentMessage(final Message message, final Message attachedMessage);  }