camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Kramer <>
Subject POP3 ---> SMTP exception when attachments are used
Date Mon, 27 Jan 2014 18:59:52 GMT

I have created the following route that pulls from a pop3 email account,
extracts some info, and then forwards the email on to an SMTP server to
different recipients depending on the use case.

	.process( new SimpleSMTPSetupProcessor() )

Note that SimpleSMTPSetupProcessor() is very simple - it clears the headers
and sets the new email addresses for the forwarded email. It does not change
the body or attachments. 

For an email without attachments, everything works as desired. Also, Camel
does a great job of not deleting the POP3 email unless it is successfully
sent over the SMTP endpoint. However, if the original incoming email has an
attachment, I receive an exception (see two test cases below). I've tried
playing with the mapMailMessage option, yet no success. The exception
changes, but still, it's not working.

Clearly the above route isn't handling the attachments properly. My question
is, what's the best approach for handling this?
1) Should Camel automagically take care of the issue?
2) Is there a type converter that I should be using but I'm missing?
3) Camel shouldn't be responsible for this and I need to write the needed
code to build the proper outgoing MimeMesage?  


Test 1
Using "mapMailMessage=true" I see the following exception

DEBUG SMTP: IOException while sending, closing, THROW: javax.mail.MessagingException: No MimeBodyPart content
	at com.sun.mail.handlers.multipart_mixed.writeTo(
	at javax.activation.ObjectDataContentHandler.writeTo(
	at javax.activation.DataHandler.writeTo(
	at javax.mail.internet.MimeBodyPart.writeTo(
	at javax.mail.internet.MimeMessage.writeTo(
	at com.sun.mail.smtp.SMTPTransport.sendMessage(
	at javax.mail.Transport.send0(
	at javax.mail.Transport.send(
In this instance, the "log:newmail" shows the following for body info:
Exchange[ExchangePattern: InOnly, BodyType:
javax.mail.internet.MimeMultipart, Body:

Test 2
Using "mapMailMessage=false" I see the following exception:

javax.mail.IllegalWriteException: POP3 messages are read-only
In this instance, the "log:newmail" shows the following for body info:
Exchange[ExchangePattern: InOnly, BodyType: com.sun.mail.pop3.POP3Message,
Body: com.sun.mail.util.BASE64DecoderStream@7d7cb4ff]

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message