title: Camel Route read Mail by call url IMAP Server, but will throw RuntimeCamelException if Content-Transfer-Encoding:quoted-printable
body: <p>everyone.
  I have an application using camel route to call url IMAP to read mail and retrieve content, <code>from(&quot;{{route1.imap.protocol}}://{{route1.imap.host}}?username={{route1.imap.username}}&amp;password={{route1.imap.password}}&amp;consumer.delay={{route1.consumer.delay}}&amp;fetchSize={{route1.fetchSize}}{{route1.otherOptions}}&quot;)&quot;</code>
  , most of the emails are read successfully by the application. But recently, we have encountered the client sends email with <strong>Content-Transfer-Encoding:quoted-printable</strong>, then the application will throw RuntimeCamelException</p>
  <pre><code>org.apache.camel.RuntimeCamelException: Failed to extract body due to: Unknown encoding: quoted-printable . Exchange: Exchange[]. Message: com.sun.mail.imap.IMAPMessage@7970ebf3
      at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:278) ~[camel-mail-2.18.1.jar:2.18.1]
      at org.apache.camel.component.mail.MailMessage.createBody(MailMessage.java:105) ~[camel-mail-2.18.1.jar:2.18.1]
      at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47) ~[camel-core-2.18.1.jar:2.18.1]
      at org.apache.camel.component.mail.MailConsumer.createExchanges(MailConsumer.java:354) ~[camel-mail-2.18.1.jar:2.18.1]
      at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:128) ~[camel-mail-2.18.1.jar:2.18.1]
      at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175) [camel-core-2.18.1.jar:2.18.1]
      at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102) [camel-core-2.18.1.jar:2.18.1]
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_281]
      at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [na:1.8.0_281]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) [na:1.8.0_281]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [na:1.8.0_281]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_281]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_281]
      at java.lang.Thread.run(Unknown Source) [na:1.8.0_281]
  Caused by: java.io.IOException: Unknown encoding: quoted-printable 
      at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:115) ~[javax.mail-1.5.5.jar:1.5.5]
      at com.sun.mail.handlers.text_plain.getContent(text_plain.java:80) ~[javax.mail-1.5.5.jar:1.5.5]
      at javax.activation.DataSourceDataContentHandler.getContent(Unknown Source) ~[na:1.8.0_281]
      at javax.activation.DataHandler.getContent(Unknown Source) ~[na:1.8.0_281]
      at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1454) ~[javax.mail-1.5.5.jar:1.5.5]
      at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:250) ~[camel-mail-2.18.1.jar:2.18.1]
      ... 13 common frames omitted
  Caused by: javax.mail.MessagingException: Unknown encoding: quoted-printable 
      at javax.mail.internet.MimeUtility.decode(MimeUtility.java:389) ~[javax.mail-1.5.5.jar:1.5.5]
      at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:108) ~[javax.mail-1.5.5.jar:1.5.5]
  </code></pre>
  <p>I try to find the solution, which i have found maybe to set System property <code>mail.mime.ignoreunknownencoding</code> to &quot;true&quot;, but i couldn't understand where to set <code>mail.mime.ignoreunknownencoding</code>. If anyone knows where to set? In Outlook, IMAP Server or my application properties?</p>
  <p>And The application using dependency <code>camel-mail:2.18.1</code>, the dependency class <code>MailBinding.class</code> in the method <code>extractBodyFromMail</code> throw this exception. Or should I rewrite the <code>MailBinding</code> Class to override method <code>extractBodyFromMail</code>.</p>
  <p>if anyone could help me, thank you very much.</p>
  <p>Add some details the infos email</p>
  <pre><code>Date: Mon, 23 May 2022 12:50:19 +0000
  From: &lt;xxx@xxxx&gt;
  To: &lt;xxx@xxxxx&gt;, &lt;xx@xxx&gt;, &lt;xx@xxx&gt;
  Subject: 1964790 - SCR_CNX_ADEP_STANDARD
  Content-Transfer-Encoding: quoted-printable 
  MIME-Version: 1.0
  Content-Type: text/plain
  Message-ID: &lt;991336a1-5f3d-449a-91af-c9a54cfb2e0f@xx.xx.local&gt;
  Return-Path: xx@xxx
  X-Originating-IP: [10.1.128.112]
  X-ClientProxiedBy: polar.airdolomiti.local (10.1.128.215) To
   polar.airdolomiti.local (10.1.128.215)
  DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xxxxxx.it; h=date:from:to:subject:content-transfer-encoding:mime-version:content-type:message-id; s=default; bh=2KBKjicvV/qIKyzYQAsZqkpDEKd3+uRQ8VlcakqOVx0=; b=E9wS98Kd+RrFNdRSOdPNwWT4Ga7P0/64LrM8plbjw1Fx7vtI1330ebvhVBjMNOuWlj8ctv+UmUs+GBnrEP/VNdLRv4vX+uPhq7JwWs9A6mlS0hWcOL4S711WLHrHdW8C4wXyQN4VmYfDRHx7jnhPwJBcY5RdWgjHf9sgOAfcdI4=
  X-MS-Exchange-Organization-ExpirationStartTime: 23 May 2022 12:50:20.4282
   (UTC)
  X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit
  X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000
  X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit
  X-MS-Exchange-Organization-Network-Message-Id:
   e760ac37-bb92-4d82-685f-08da3cbacba1
  X-EOPAttributedMessage: 0
  X-EOPTenantAttributedMessage: d3fc41ce-14c2-4518-9065-8fe78ff84136:0
  X-MS-Exchange-Organization-MessageDirectionality: Incoming
  X-MS-PublicTrafficType: Email
  X-MS-Exchange-Organization-AuthSource:
   PR2FRA01FT010.eop-fra01.prod.protection.outlook.com
  X-MS-Exchange-Organization-AuthAs: Anonymous
  X-MS-Office365-Filtering-Correlation-Id: e760ac37-bb92-4d82-685f-08da3cbacba1
  X-MS-TrafficTypeDiagnostic: PR0P264MB2439:EE_
  X-MS-Exchange-Organization-SCL: -1
  X-Microsoft-Antispam: BCL:0;
  X-Forefront-Antispam-Report:
   CIP:151.11.112.123;CTRY:IT;LANG:en;SCL:-1;SRV:;IPV:NLI;SFV:SFE;H:mail.airdolomiti.it;PTR:mail.airdolomiti.it;CAT:NONE;SFS:;DIR:INB;
  X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2022 12:50:20.2876
   (UTC)
  X-MS-Exchange-CrossTenant-Network-Message-Id: e760ac37-bb92-4d82-685f-08da3cbacba1
  X-MS-Exchange-CrossTenant-Id: d3fc41ce-14c2-4518-9065-8fe78ff84136
  X-MS-Exchange-CrossTenant-AuthSource:
   PR2FRA01FT010.eop-fra01.prod.protection.outlook.com
  X-MS-Exchange-CrossTenant-AuthAs: Anonymous
  X-MS-Exchange-CrossTenant-FromEntityHeader: Internet
  X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB2439
  X-MS-Exchange-Transport-EndToEndLatency: 00:00:01.9451105
  X-MS-Exchange-Processed-By-BccFoldering: 15.20.5273.022
  X-Microsoft-Antispam-Mailbox-Delivery:
  </code></pre>