Hi You can try with mapMailMessage=false, and then use Camel's error handler if parsing the body / attachments of the mail fails.
Though there was a bug in Camel when using mapMailMessage=false. You may need to use next release of Camel and/or latest release if the bug was fixed in that release. An alternative is to add functionality to the mail component to deal with parsing errors before routing, such as mark it as seen or move it etc. On Mon, Apr 7, 2014 at 5:27 PM, <stefan....@zv-extern.fraunhofer.de> wrote: > Hello, > > if I use the mail-component for polling emails and there is an error while > consuming the mail, how can I skip this mail and move to the next? > > For example: > > from("imaps://{{email.server}}?username={{email.username}}&password=RAW({{email.password}})" > + "&delete=true©To={{email.folder}}/done&unseen=true& > folderName={{email.folder}}" > + "&fetchSize=1&contentType=text/html") > moves the processed mail in the "done"-subfolder of the email-folder, if > everything is ok, eg, the route finishes. > > But if the mail-consumer hits an error _before_ the route starts, the error > will be logged and nothing more happens. This means, the processed mail > remains unchanged in in the email-folder and will be the next polled email, > that leads to the same error, where the error will be logged and... > > How can I break this endless circle an mark the email as (unsuccessfully) > processed, so that it will not be read again? > > Best regards, > Stefan Hof > -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen Make your Camel applications look hawt, try: http://hawt.io