The toString method in org.apache.camel.component.mail.MailConverters
is overloaded to handle both javax.mail.Message and
javax.mail.Multipart. The implementation fo the Message version checks
for a MimeMultipart instance and if so uses the first body part. The
implementation of the Multipart version walks the message and uses the
first text content type.

Why are these methods handling the conversion differently?

I came across this because the mail server I'm testing against
(squirrelmail) isn't returning Content-Type for MimeMultipart
messages. I kept seeing javax.mail.internet.MimeMultipart@123456 for
the message payload because the @Converter method is MailConverts was
not handling the case of the missing Content-Type and a default
toString was used. After reviewing the code, it looks like it would
work fine if I disabled the mapping of the Message content and left
the original payload as a javax.mail.Message.

Reply via email to