}
protected void createMultipartAlternativeMessage(MimeMessage mimeMessage, MailConfiguration configuration, Exchange exchange)
throws MessagingException, IOException {
MimeMultipart multipartAlternative = new MimeMultipart("alternative");
mimeMessage.setContent(multipartAlternative);
MimeBodyPart plainText = new MimeBodyPart();
plainText.setText(getAlternativeBody(configuration, exchange), determineCharSet(configuration, exchange));
// remove the header with the alternative mail now that we got it
// otherwise it might end up twice in the mail reader
exchange.getIn().removeHeader(configuration.getAlternativeBodyHeader());
multipartAlternative.addBodyPart(plainText);
// if there are no attachments, add the body to the same mulitpart message
if (!exchange.getIn().hasAttachments()) {
addBodyToMultipart(configuration, multipartAlternative, exchange);
} else {
// if there are attachments, but they aren't set to be inline, add them to
// treat them as normal. It will append a multipart-mixed with the attachments and the body text
if (!configuration.isUseInlineAttachments()) {
BodyPart mixedAttachments = new MimeBodyPart();
mixedAttachments.setContent(createMixedMultipartAttachments(configuration, exchange));
multipartAlternative.addBodyPart(mixedAttachments);
} else {
// if the attachments are set to be inline, attach them as inline attachments
MimeMultipart multipartRelated = new MimeMultipart("related");
BodyPart related = new MimeBodyPart();
related.setContent(multipartRelated);
multipartAlternative.addBodyPart(related);