You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by FlyingFl <fl...@yahoo.com> on 2008/11/06 23:41:42 UTC

Read mail attachments from pop3 accounts and save them to file system

Hi everyone,
i'm trying to  use Camel in thi scenario:
polling a pop3 account and save every incoming message and every attachment
on filesystem

ok polling the account, but how can I extract attachments?

Here is my processor:
import javax.mail.internet.MimeMultipart;

import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;

public class MailReaderProcessor implements Processor {

	public void process(final Exchange exchange) throws Exception {
		final Message m = exchange.getIn();
		final MimeMultipart multi = m.getBody(MimeMultipart.class);
		if (multi != null)
			System.out.println("count multipart: " + multi.getCount());
	}

}


and here is my router:

public class Pop3ToFileRouteBuilder extends SpringRouteBuilder {
	private final String fileUrl =
"file:///Users/francesco/Documents/projects/tools/apache-camel-1.3.0/out?append=false&noop=true";


	private final String imapUrl =
"pop3://mymailserver?password=test&username=test&deleteProcessedMessages=false&processOnlyUnseenMessages=false&contentType=multipart/mixed&consumer.initialDelay=500&consumer.delay=5000";

	Processor myProcessor = new MailReaderProcessor();

	public void configure() throws Exception {
	
from(imapUrl).process(myProcessor).convertBodyTo(String.class).to(fileUrl);
	}
}


The m.getBody statement return the body of the message as string... how can
i read it as multipart message?

thanks!!!!

Francesco

-- 
View this message in context: http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20362680.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Read mail attachments from pop3 accounts and save them to file system

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Feb 26, 2010 at 5:07 PM, beat glattfelder <be...@glattfelder.com> wrote:
>
> Hi Camel Riders
>
> I am having the same issue with pop3. Debugging the code reveals
> com.sun.mail.pop3.POP3Message.getContent is returning a String instead of a
> Multipart object, so though strictly this is not a camel issue, I still
> would like to know if someone remembers how this has been resolved?
>

Can you now switch to use imap? It often works much better than pop3.



>
>
> FlyingFl wrote:
>>
>> Hi everyone,
>> i'm trying to  use Camel in thi scenario:
>> polling a pop3 account and save every incoming message and every
>> attachment on filesystem
>>
>> ok polling the account, but how can I extract attachments?
>>
>> Here is my processor:
>> import javax.mail.internet.MimeMultipart;
>>
>> import org.apache.camel.Exchange;
>> import org.apache.camel.Message;
>> import org.apache.camel.Processor;
>>
>> public class MailReaderProcessor implements Processor {
>>
>>       public void process(final Exchange exchange) throws Exception {
>>               final Message m = exchange.getIn();
>>               final MimeMultipart multi = m.getBody(MimeMultipart.class);
>>               if (multi != null)
>>                       System.out.println("count multipart: " + multi.getCount());
>>       }
>>
>> }
>>
>>
>> and here is my router:
>>
>> public class Pop3ToFileRouteBuilder extends SpringRouteBuilder {
>>       private final String fileUrl =
>> "file:///Users/francesco/Documents/projects/tools/apache-camel-1.3.0/out?append=false&noop=true";
>>
>>
>>       private final String imapUrl =
>> "pop3://mymailserver?password=test&username=test&deleteProcessedMessages=false&processOnlyUnseenMessages=false&contentType=multipart/mixed&consumer.initialDelay=500&consumer.delay=5000";
>>
>>       Processor myProcessor = new MailReaderProcessor();
>>
>>       public void configure() throws Exception {
>>
>> from(imapUrl).process(myProcessor).convertBodyTo(String.class).to(fileUrl);
>>       }
>> }
>>
>>
>> The m.getBody statement return the body of the message as string... how
>> can i read it as multipart message?
>>
>> thanks!!!!
>>
>> Francesco
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680p27720099.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Read mail attachments from pop3 accounts and save them to file system

Posted by beat glattfelder <be...@glattfelder.com>.
Hi Camel Riders

I am having the same issue with pop3. Debugging the code reveals
com.sun.mail.pop3.POP3Message.getContent is returning a String instead of a
Multipart object, so though strictly this is not a camel issue, I still
would like to know if someone remembers how this has been resolved?



FlyingFl wrote:
> 
> Hi everyone,
> i'm trying to  use Camel in thi scenario:
> polling a pop3 account and save every incoming message and every
> attachment on filesystem
> 
> ok polling the account, but how can I extract attachments?
> 
> Here is my processor:
> import javax.mail.internet.MimeMultipart;
> 
> import org.apache.camel.Exchange;
> import org.apache.camel.Message;
> import org.apache.camel.Processor;
> 
> public class MailReaderProcessor implements Processor {
> 
> 	public void process(final Exchange exchange) throws Exception {
> 		final Message m = exchange.getIn();
> 		final MimeMultipart multi = m.getBody(MimeMultipart.class);
> 		if (multi != null)
> 			System.out.println("count multipart: " + multi.getCount());
> 	}
> 
> }
> 
> 
> and here is my router:
> 
> public class Pop3ToFileRouteBuilder extends SpringRouteBuilder {
> 	private final String fileUrl =
> "file:///Users/francesco/Documents/projects/tools/apache-camel-1.3.0/out?append=false&noop=true";
> 
> 
> 	private final String imapUrl =
> "pop3://mymailserver?password=test&username=test&deleteProcessedMessages=false&processOnlyUnseenMessages=false&contentType=multipart/mixed&consumer.initialDelay=500&consumer.delay=5000";
> 
> 	Processor myProcessor = new MailReaderProcessor();
> 
> 	public void configure() throws Exception {
> 	
> from(imapUrl).process(myProcessor).convertBodyTo(String.class).to(fileUrl);
> 	}
> }
> 
> 
> The m.getBody statement return the body of the message as string... how
> can i read it as multipart message?
> 
> thanks!!!!
> 
> Francesco
> 
> 

-- 
View this message in context: http://old.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680p27720099.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


RE: Read mail attachments from pop3 accounts and save them to file system

Posted by FlyingFl <fl...@yahoo.com>.
ok Claus, I'll try to debug it
Francesco


Claus Ibsen wrote:
> 
> Hi
> 
> Try enabling mail debug and attach a debugger to look in the code what you
> have on the objects.
> 
> http://activemq.apache.org/camel/mail.html
> 
> Setting the debugMode=true option.
> 
> Have you tried with IMAP instead of POP3?
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: FlyingFl [mailto:flying_fl@yahoo.com] 
> Sent: 7. november 2008 18:03
> To: camel-user@activemq.apache.org
> Subject: RE: Read mail attachments from pop3 accounts and save them to
> file system
> 
> 
> Hi
> I've a message in my mailbox with a PDF file as attachment
> I've tried this from MailAttachmentsTest.java:
> 
>     final Map<String, DataHandler> attachments =
> exchange.getIn().getAttachments();
> 
> And I get an empty Map
> 
> The same happen with:
> 
>     for (String s : exchange.getIn().getAttachmentNames()) {...
> 
> So I can't get any attachments from the  exchange object
> 
> Please help me!
> 
> thanks
> Francesco
> 
> 
> 
> 
> 
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> The mail component is documented here:
>> http://activemq.apache.org/camel/mail.html
>> 
>> We might need to improve it a bit to show how to read the attachments.
>> There is only a send sample.
>> 
>> However looking at the camel unit test is also a great place to start.
>> There is indeed a test for send and receive emails with attachment there
>> -
>> MailAttachmentTest
>> http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/
>> 
>> The API should have a getAttachments() method. But check the unit test.
>> 
>> 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: FlyingFl [mailto:flying_fl@yahoo.com] 
>> Sent: 6. november 2008 23:42
>> To: camel-user@activemq.apache.org
>> Subject: Read mail attachments from pop3 accounts and save them to file
>> system
>> 
>> 
>> Hi everyone,
>> i'm trying to  use Camel in thi scenario:
>> polling a pop3 account and save every incoming message and every
>> attachment
>> on filesystem
>> 
>> ok polling the account, but how can I extract attachments?
>> 
>> Here is my processor:
>> import javax.mail.internet.MimeMultipart;
>> 
>> import org.apache.camel.Exchange;
>> import org.apache.camel.Message;
>> import org.apache.camel.Processor;
>> 
>> public class MailReaderProcessor implements Processor {
>> 
>> 	public void process(final Exchange exchange) throws Exception {
>> 		final Message m = exchange.getIn();
>> 		final MimeMultipart multi = m.getBody(MimeMultipart.class);
>> 		if (multi != null)
>> 			System.out.println("count multipart: " + multi.getCount());
>> 	}
>> 
>> }
>> 
>> 
>> and here is my router:
>> 
>> public class Pop3ToFileRouteBuilder extends SpringRouteBuilder {
>> 	private final String fileUrl =
>> "file:///Users/francesco/Documents/projects/tools/apache-camel-1.3.0/out?append=false&noop=true";
>> 
>> 
>> 	private final String imapUrl =
>> "pop3://mymailserver?password=test&username=test&deleteProcessedMessages=false&processOnlyUnseenMessages=false&contentType=multipart/mixed&consumer.initialDelay=500&consumer.delay=5000";
>> 
>> 	Processor myProcessor = new MailReaderProcessor();
>> 
>> 	public void configure() throws Exception {
>> 	
>> from(imapUrl).process(myProcessor).convertBodyTo(String.class).to(fileUrl);
>> 	}
>> }
>> 
>> 
>> The m.getBody statement return the body of the message as string... how
>> can
>> i read it as multipart message?
>> 
>> thanks!!!!
>> 
>> Francesco
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20362680.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20384612.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20396586.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Read mail attachments from pop3 accounts and save them to file system

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Try enabling mail debug and attach a debugger to look in the code what you have on the objects.

http://activemq.apache.org/camel/mail.html

Setting the debugMode=true option.

Have you tried with IMAP instead of POP3?



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: FlyingFl [mailto:flying_fl@yahoo.com] 
Sent: 7. november 2008 18:03
To: camel-user@activemq.apache.org
Subject: RE: Read mail attachments from pop3 accounts and save them to file system


Hi
I've a message in my mailbox with a PDF file as attachment
I've tried this from MailAttachmentsTest.java:

    final Map<String, DataHandler> attachments =
exchange.getIn().getAttachments();

And I get an empty Map

The same happen with:

    for (String s : exchange.getIn().getAttachmentNames()) {...

So I can't get any attachments from the  exchange object

Please help me!

thanks
Francesco








Claus Ibsen wrote:
> 
> Hi
> 
> The mail component is documented here:
> http://activemq.apache.org/camel/mail.html
> 
> We might need to improve it a bit to show how to read the attachments.
> There is only a send sample.
> 
> However looking at the camel unit test is also a great place to start.
> There is indeed a test for send and receive emails with attachment there -
> MailAttachmentTest
> http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/
> 
> The API should have a getAttachments() method. But check the unit test.
> 
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: FlyingFl [mailto:flying_fl@yahoo.com] 
> Sent: 6. november 2008 23:42
> To: camel-user@activemq.apache.org
> Subject: Read mail attachments from pop3 accounts and save them to file
> system
> 
> 
> Hi everyone,
> i'm trying to  use Camel in thi scenario:
> polling a pop3 account and save every incoming message and every
> attachment
> on filesystem
> 
> ok polling the account, but how can I extract attachments?
> 
> Here is my processor:
> import javax.mail.internet.MimeMultipart;
> 
> import org.apache.camel.Exchange;
> import org.apache.camel.Message;
> import org.apache.camel.Processor;
> 
> public class MailReaderProcessor implements Processor {
> 
> 	public void process(final Exchange exchange) throws Exception {
> 		final Message m = exchange.getIn();
> 		final MimeMultipart multi = m.getBody(MimeMultipart.class);
> 		if (multi != null)
> 			System.out.println("count multipart: " + multi.getCount());
> 	}
> 
> }
> 
> 
> and here is my router:
> 
> public class Pop3ToFileRouteBuilder extends SpringRouteBuilder {
> 	private final String fileUrl =
> "file:///Users/francesco/Documents/projects/tools/apache-camel-1.3.0/out?append=false&noop=true";
> 
> 
> 	private final String imapUrl =
> "pop3://mymailserver?password=test&username=test&deleteProcessedMessages=false&processOnlyUnseenMessages=false&contentType=multipart/mixed&consumer.initialDelay=500&consumer.delay=5000";
> 
> 	Processor myProcessor = new MailReaderProcessor();
> 
> 	public void configure() throws Exception {
> 	
> from(imapUrl).process(myProcessor).convertBodyTo(String.class).to(fileUrl);
> 	}
> }
> 
> 
> The m.getBody statement return the body of the message as string... how
> can
> i read it as multipart message?
> 
> thanks!!!!
> 
> Francesco
> 
> -- 
> View this message in context:
> http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20362680.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20384612.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Read mail attachments from pop3 accounts and save them to file system

Posted by FlyingFl <fl...@yahoo.com>.
Hi
I've a message in my mailbox with a PDF file as attachment
I've tried this from MailAttachmentsTest.java:

    final Map<String, DataHandler> attachments =
exchange.getIn().getAttachments();

And I get an empty Map

The same happen with:

    for (String s : exchange.getIn().getAttachmentNames()) {...

So I can't get any attachments from the  exchange object

Please help me!

thanks
Francesco








Claus Ibsen wrote:
> 
> Hi
> 
> The mail component is documented here:
> http://activemq.apache.org/camel/mail.html
> 
> We might need to improve it a bit to show how to read the attachments.
> There is only a send sample.
> 
> However looking at the camel unit test is also a great place to start.
> There is indeed a test for send and receive emails with attachment there -
> MailAttachmentTest
> http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/
> 
> The API should have a getAttachments() method. But check the unit test.
> 
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: FlyingFl [mailto:flying_fl@yahoo.com] 
> Sent: 6. november 2008 23:42
> To: camel-user@activemq.apache.org
> Subject: Read mail attachments from pop3 accounts and save them to file
> system
> 
> 
> Hi everyone,
> i'm trying to  use Camel in thi scenario:
> polling a pop3 account and save every incoming message and every
> attachment
> on filesystem
> 
> ok polling the account, but how can I extract attachments?
> 
> Here is my processor:
> import javax.mail.internet.MimeMultipart;
> 
> import org.apache.camel.Exchange;
> import org.apache.camel.Message;
> import org.apache.camel.Processor;
> 
> public class MailReaderProcessor implements Processor {
> 
> 	public void process(final Exchange exchange) throws Exception {
> 		final Message m = exchange.getIn();
> 		final MimeMultipart multi = m.getBody(MimeMultipart.class);
> 		if (multi != null)
> 			System.out.println("count multipart: " + multi.getCount());
> 	}
> 
> }
> 
> 
> and here is my router:
> 
> public class Pop3ToFileRouteBuilder extends SpringRouteBuilder {
> 	private final String fileUrl =
> "file:///Users/francesco/Documents/projects/tools/apache-camel-1.3.0/out?append=false&noop=true";
> 
> 
> 	private final String imapUrl =
> "pop3://mymailserver?password=test&username=test&deleteProcessedMessages=false&processOnlyUnseenMessages=false&contentType=multipart/mixed&consumer.initialDelay=500&consumer.delay=5000";
> 
> 	Processor myProcessor = new MailReaderProcessor();
> 
> 	public void configure() throws Exception {
> 	
> from(imapUrl).process(myProcessor).convertBodyTo(String.class).to(fileUrl);
> 	}
> }
> 
> 
> The m.getBody statement return the body of the message as string... how
> can
> i read it as multipart message?
> 
> thanks!!!!
> 
> Francesco
> 
> -- 
> View this message in context:
> http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20362680.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20384612.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Read mail attachments from pop3 accounts and save them to file system

Posted by FlyingFl <fl...@yahoo.com>.
thanks for your replay, I'll go to check the unit test
Francesco


Claus Ibsen wrote:
> 
> Hi
> 
> The mail component is documented here:
> http://activemq.apache.org/camel/mail.html
> 
> We might need to improve it a bit to show how to read the attachments.
> There is only a send sample.
> 
> However looking at the camel unit test is also a great place to start.
> There is indeed a test for send and receive emails with attachment there -
> MailAttachmentTest
> http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/
> 
> The API should have a getAttachments() method. But check the unit test.
> 
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: FlyingFl [mailto:flying_fl@yahoo.com] 
> Sent: 6. november 2008 23:42
> To: camel-user@activemq.apache.org
> Subject: Read mail attachments from pop3 accounts and save them to file
> system
> 
> 
> Hi everyone,
> i'm trying to  use Camel in thi scenario:
> polling a pop3 account and save every incoming message and every
> attachment
> on filesystem
> 
> ok polling the account, but how can I extract attachments?
> 
> Here is my processor:
> import javax.mail.internet.MimeMultipart;
> 
> import org.apache.camel.Exchange;
> import org.apache.camel.Message;
> import org.apache.camel.Processor;
> 
> public class MailReaderProcessor implements Processor {
> 
> 	public void process(final Exchange exchange) throws Exception {
> 		final Message m = exchange.getIn();
> 		final MimeMultipart multi = m.getBody(MimeMultipart.class);
> 		if (multi != null)
> 			System.out.println("count multipart: " + multi.getCount());
> 	}
> 
> }
> 
> 
> and here is my router:
> 
> public class Pop3ToFileRouteBuilder extends SpringRouteBuilder {
> 	private final String fileUrl =
> "file:///Users/francesco/Documents/projects/tools/apache-camel-1.3.0/out?append=false&noop=true";
> 
> 
> 	private final String imapUrl =
> "pop3://mymailserver?password=test&username=test&deleteProcessedMessages=false&processOnlyUnseenMessages=false&contentType=multipart/mixed&consumer.initialDelay=500&consumer.delay=5000";
> 
> 	Processor myProcessor = new MailReaderProcessor();
> 
> 	public void configure() throws Exception {
> 	
> from(imapUrl).process(myProcessor).convertBodyTo(String.class).to(fileUrl);
> 	}
> }
> 
> 
> The m.getBody statement return the body of the message as string... how
> can
> i read it as multipart message?
> 
> thanks!!!!
> 
> Francesco
> 
> -- 
> View this message in context:
> http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20362680.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20379370.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Read mail attachments from pop3 accounts and save them to file system

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

The mail component is documented here:
http://activemq.apache.org/camel/mail.html

We might need to improve it a bit to show how to read the attachments. There is only a send sample.

However looking at the camel unit test is also a great place to start. There is indeed a test for send and receive emails with attachment there - MailAttachmentTest
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/

The API should have a getAttachments() method. But check the unit test.




Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: FlyingFl [mailto:flying_fl@yahoo.com] 
Sent: 6. november 2008 23:42
To: camel-user@activemq.apache.org
Subject: Read mail attachments from pop3 accounts and save them to file system


Hi everyone,
i'm trying to  use Camel in thi scenario:
polling a pop3 account and save every incoming message and every attachment
on filesystem

ok polling the account, but how can I extract attachments?

Here is my processor:
import javax.mail.internet.MimeMultipart;

import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;

public class MailReaderProcessor implements Processor {

	public void process(final Exchange exchange) throws Exception {
		final Message m = exchange.getIn();
		final MimeMultipart multi = m.getBody(MimeMultipart.class);
		if (multi != null)
			System.out.println("count multipart: " + multi.getCount());
	}

}


and here is my router:

public class Pop3ToFileRouteBuilder extends SpringRouteBuilder {
	private final String fileUrl =
"file:///Users/francesco/Documents/projects/tools/apache-camel-1.3.0/out?append=false&noop=true";


	private final String imapUrl =
"pop3://mymailserver?password=test&username=test&deleteProcessedMessages=false&processOnlyUnseenMessages=false&contentType=multipart/mixed&consumer.initialDelay=500&consumer.delay=5000";

	Processor myProcessor = new MailReaderProcessor();

	public void configure() throws Exception {
	
from(imapUrl).process(myProcessor).convertBodyTo(String.class).to(fileUrl);
	}
}


The m.getBody statement return the body of the message as string... how can
i read it as multipart message?

thanks!!!!

Francesco

-- 
View this message in context: http://www.nabble.com/Read-mail-attachments-from-pop3-accounts-and-save-them-to-file-system-tp20362680s22882p20362680.html
Sent from the Camel - Users mailing list archive at Nabble.com.