You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Philipp Koch <ph...@senacor.com> on 2012/12/11 16:51:49 UTC

Emails with invalid Format (SPAM) block EMail Processing with: "Error populating the initial mail message attachments"

Hi Everybody,

we haven an problem with camel processing SPAM Emails with an invalid 
Format. 
If sometimes an Email with an invalid format (Mostly Spam) reaches our
Mailbox the processing of the Mailbox is blocked till the EMail has manually
delete from the Mailbox. 

We are using an Spam Filter to block most of this kind of EMail but it could
not block 100% of it.

If this error occur the following exception will be dumped:
[ERROR mail.MailConsumer][Camel (camel-emailRoute) thread #8 -
pop3://mkp@dpp.junit.de]  Caused by: [org.apache.camel.RuntimeCamelException
- Error populating the initial mail message attachments]
org.apache.camel.RuntimeCamelException: Error populating the initial mail
message attachments
	at
org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:124)
	at
org.apache.camel.impl.DefaultMessage.createAttachments(DefaultMessage.java:216)
	at
org.apache.camel.impl.DefaultMessage.getAttachments(DefaultMessage.java:281)
	at org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:62)
	at org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:33)
	at
org.apache.camel.impl.DefaultUnitOfWork.<init>(DefaultUnitOfWork.java:91)
	at
org.apache.camel.impl.DefaultUnitOfWork.<init>(DefaultUnitOfWork.java:71)
	at
org.apache.camel.processor.UnitOfWorkProcessor.createUnitOfWork(UnitOfWorkProcessor.java:190)
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)
	at
org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:50)
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
	at
org.apache.camel.component.mail.MailConsumer.processExchange(MailConsumer.java:296)
	at
org.apache.camel.component.mail.MailConsumer.processBatch(MailConsumer.java:199)
	at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:121)
	at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:138)
	at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:90)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: javax.mail.MessagingException: Missing start boundary
	at javax.mail.internet.MimeMultipart.parsebm(MimeMultipart.java:872)
	at javax.mail.internet.MimeMultipart.parse(MimeMultipart.java:493)
	at javax.mail.internet.MimeMultipart.getCount(MimeMultipart.java:240)
	at
org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMultipart(MailBinding.java:297)
	at
org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMail(MailBinding.java:286)
	at
org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:121)
	... 30 more

We use the following setting for our EMail Endpoint (This is from our
testcase):
pop3://mkp@dpp.junit.de?consumer.delay=1000&debugMode=true&delete=true&ignoreUnsupportedCharset=true&password=******&pollStrategy=%23dbLockPollingConsumerPollStrategy&unseen=true

We use an custom Polling strategy for Synchronizing two server Notes
"dbLockPollingConsumerPollStrategy". Interesting is here that in the error
case only the commit method will be called and not the roll-back method as
expected.

My Question is: 
Is there a way to configure the Email Component, that these Messages will be
delete or moved to an other folder, that they will not block the processing
any more. 

Thanks! 
Philipp 



--
View this message in context: http://camel.465427.n5.nabble.com/Emails-with-invalid-Format-SPAM-block-EMail-Processing-with-Error-populating-the-initial-mail-messag-tp5723912.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Emails with invalid Format (SPAM) block EMail Processing with: "Error populating the initial mail message attachments"

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Dec 13, 2012 at 8:24 AM, Christoph Emmersberger
<ce...@googlemail.com> wrote:
> Hi Philipp,
>
> is it possible to provide some more information (e.g. an example of a mail message that breaks the processing) and open a JIRA Ticket targeting this issue?
>
> https://issues.apache.org/jira/browse/CAMEL
>

Yeah that may be doable to add a new option to let people ignore
invalid attachments.
We have it for charsets etc.

There is this option you can turn off mapMailMessage=false.
But then you would need to read the mail using the "raw" java mail api.

Though the code in MailBinding may be reusable, which is the code
Camel uses to map from java mail to Camel Exchange.



> Cheers,
>
> Christoph
>
> On Dec 11, 2012, at 4:51 PM, Philipp Koch wrote:
>
>> Hi Everybody,
>>
>> we haven an problem with camel processing SPAM Emails with an invalid
>> Format.
>> If sometimes an Email with an invalid format (Mostly Spam) reaches our
>> Mailbox the processing of the Mailbox is blocked till the EMail has manually
>> delete from the Mailbox.
>>
>> We are using an Spam Filter to block most of this kind of EMail but it could
>> not block 100% of it.
>>
>> If this error occur the following exception will be dumped:
>> [ERROR mail.MailConsumer][Camel (camel-emailRoute) thread #8 -
>> pop3://mkp@dpp.junit.de]  Caused by: [org.apache.camel.RuntimeCamelException
>> - Error populating the initial mail message attachments]
>> org.apache.camel.RuntimeCamelException: Error populating the initial mail
>> message attachments
>>       at
>> org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:124)
>>       at
>> org.apache.camel.impl.DefaultMessage.createAttachments(DefaultMessage.java:216)
>>       at
>> org.apache.camel.impl.DefaultMessage.getAttachments(DefaultMessage.java:281)
>>       at org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:62)
>>       at org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:33)
>>       at
>> org.apache.camel.impl.DefaultUnitOfWork.<init>(DefaultUnitOfWork.java:91)
>>       at
>> org.apache.camel.impl.DefaultUnitOfWork.<init>(DefaultUnitOfWork.java:71)
>>       at
>> org.apache.camel.processor.UnitOfWorkProcessor.createUnitOfWork(UnitOfWorkProcessor.java:190)
>>       at
>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)
>>       at
>> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:50)
>>       at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>>       at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>>       at
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>>       at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>>       at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
>>       at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>>       at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
>>       at
>> org.apache.camel.component.mail.MailConsumer.processExchange(MailConsumer.java:296)
>>       at
>> org.apache.camel.component.mail.MailConsumer.processBatch(MailConsumer.java:199)
>>       at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:121)
>>       at
>> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:138)
>>       at
>> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:90)
>>       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>>       at
>> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>>       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>>       at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>>       at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
>>       at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
>>       at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>       at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>       at java.lang.Thread.run(Thread.java:662)
>> Caused by: javax.mail.MessagingException: Missing start boundary
>>       at javax.mail.internet.MimeMultipart.parsebm(MimeMultipart.java:872)
>>       at javax.mail.internet.MimeMultipart.parse(MimeMultipart.java:493)
>>       at javax.mail.internet.MimeMultipart.getCount(MimeMultipart.java:240)
>>       at
>> org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMultipart(MailBinding.java:297)
>>       at
>> org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMail(MailBinding.java:286)
>>       at
>> org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:121)
>>       ... 30 more
>>
>> We use the following setting for our EMail Endpoint (This is from our
>> testcase):
>> pop3://mkp@dpp.junit.de?consumer.delay=1000&debugMode=true&delete=true&ignoreUnsupportedCharset=true&password=******&pollStrategy=%23dbLockPollingConsumerPollStrategy&unseen=true
>>
>> We use an custom Polling strategy for Synchronizing two server Notes
>> "dbLockPollingConsumerPollStrategy". Interesting is here that in the error
>> case only the commit method will be called and not the roll-back method as
>> expected.
>>
>> My Question is:
>> Is there a way to configure the Email Component, that these Messages will be
>> delete or moved to an other folder, that they will not block the processing
>> any more.
>>
>> Thanks!
>> Philipp
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Emails-with-invalid-Format-SPAM-block-EMail-Processing-with-Error-populating-the-initial-mail-messag-tp5723912.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Emails with invalid Format (SPAM) block EMail Processing with: "Error populating the initial mail message attachments"

Posted by Christoph Emmersberger <ce...@googlemail.com>.
Hi Philipp,

is it possible to provide some more information (e.g. an example of a mail message that breaks the processing) and open a JIRA Ticket targeting this issue?

https://issues.apache.org/jira/browse/CAMEL

Cheers,

Christoph

On Dec 11, 2012, at 4:51 PM, Philipp Koch wrote:

> Hi Everybody,
> 
> we haven an problem with camel processing SPAM Emails with an invalid 
> Format. 
> If sometimes an Email with an invalid format (Mostly Spam) reaches our
> Mailbox the processing of the Mailbox is blocked till the EMail has manually
> delete from the Mailbox. 
> 
> We are using an Spam Filter to block most of this kind of EMail but it could
> not block 100% of it.
> 
> If this error occur the following exception will be dumped:
> [ERROR mail.MailConsumer][Camel (camel-emailRoute) thread #8 -
> pop3://mkp@dpp.junit.de]  Caused by: [org.apache.camel.RuntimeCamelException
> - Error populating the initial mail message attachments]
> org.apache.camel.RuntimeCamelException: Error populating the initial mail
> message attachments
> 	at
> org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:124)
> 	at
> org.apache.camel.impl.DefaultMessage.createAttachments(DefaultMessage.java:216)
> 	at
> org.apache.camel.impl.DefaultMessage.getAttachments(DefaultMessage.java:281)
> 	at org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:62)
> 	at org.apache.camel.component.mail.MailMessage.copy(MailMessage.java:33)
> 	at
> org.apache.camel.impl.DefaultUnitOfWork.<init>(DefaultUnitOfWork.java:91)
> 	at
> org.apache.camel.impl.DefaultUnitOfWork.<init>(DefaultUnitOfWork.java:71)
> 	at
> org.apache.camel.processor.UnitOfWorkProcessor.createUnitOfWork(UnitOfWorkProcessor.java:190)
> 	at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)
> 	at
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:50)
> 	at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> 	at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> 	at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> 	at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> 	at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
> 	at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
> 	at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
> 	at
> org.apache.camel.component.mail.MailConsumer.processExchange(MailConsumer.java:296)
> 	at
> org.apache.camel.component.mail.MailConsumer.processBatch(MailConsumer.java:199)
> 	at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:121)
> 	at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:138)
> 	at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:90)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> 	at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> 	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> 	at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> 	at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
> 	at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:662)
> Caused by: javax.mail.MessagingException: Missing start boundary
> 	at javax.mail.internet.MimeMultipart.parsebm(MimeMultipart.java:872)
> 	at javax.mail.internet.MimeMultipart.parse(MimeMultipart.java:493)
> 	at javax.mail.internet.MimeMultipart.getCount(MimeMultipart.java:240)
> 	at
> org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMultipart(MailBinding.java:297)
> 	at
> org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMail(MailBinding.java:286)
> 	at
> org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:121)
> 	... 30 more
> 
> We use the following setting for our EMail Endpoint (This is from our
> testcase):
> pop3://mkp@dpp.junit.de?consumer.delay=1000&debugMode=true&delete=true&ignoreUnsupportedCharset=true&password=******&pollStrategy=%23dbLockPollingConsumerPollStrategy&unseen=true
> 
> We use an custom Polling strategy for Synchronizing two server Notes
> "dbLockPollingConsumerPollStrategy". Interesting is here that in the error
> case only the commit method will be called and not the roll-back method as
> expected.
> 
> My Question is: 
> Is there a way to configure the Email Component, that these Messages will be
> delete or moved to an other folder, that they will not block the processing
> any more. 
> 
> Thanks! 
> Philipp 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Emails-with-invalid-Format-SPAM-block-EMail-Processing-with-Error-populating-the-initial-mail-messag-tp5723912.html
> Sent from the Camel - Users mailing list archive at Nabble.com.