Hello, 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.
.from("pop3://...&mapMailMessage=true") .process( new SimpleSMTPSetupProcessor() ) .to("log:newmail") .to("smtp://...&debugMode=true"); 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? Thanks! John Test 1 ----------------------------------------------------------------------------- Using "mapMailMessage=true" I see the following exception DEBUG SMTP: IOException while sending, closing, THROW: java.io.IOException: javax.mail.MessagingException: No MimeBodyPart content at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:105) at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:884) at javax.activation.DataHandler.writeTo(DataHandler.java:317) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1485) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1773) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1119) at javax.mail.Transport.send0(Transport.java:195) at javax.mail.Transport.send(Transport.java:124) at org.apache.camel.component.mail.DefaultJavaMailSender.send(DefaultJavaMailSender.java:128) In this instance, the "log:newmail" shows the following for body info: Exchange[ExchangePattern: InOnly, BodyType: javax.mail.internet.MimeMultipart, Body: javax.mail.internet.MimeMultipart@613278bf] Test 2 ----------------------------------------------------------------------------- Using "mapMailMessage=false" I see the following exception: javax.mail.IllegalWriteException: POP3 messages are read-only at com.sun.mail.pop3.POP3Message.saveChanges(POP3Message.java:546)[mail-1.4.7.jar:1.4.7] at org.apache.camel.component.mail.DefaultJavaMailSender.send(DefaultJavaMailSender.java:118)[camel-mail-2.12.2.jar:2.12.2] 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: http://camel.465427.n5.nabble.com/POP3-SMTP-exception-when-attachments-are-used-tp5746508.html Sent from the Camel - Users mailing list archive at Nabble.com.