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.

Reply via email to