Cfimap java.nio.charset.IllegalCharsetNameException error

Some emails I fetch with cfimap have the following java error in them instead of the actual body of the email:

ISO-8859-1Precedence: java.nio.charset.IllegalCharsetNameException: "ISO-8859-1Precedence: 
  at java.nio.charset.Charset.checkName(Charset.java:315) 
  at java.nio.charset.Charset.lookup2(Charset.java:484) 
  at java.nio.charset.Charset.lookup(Charset.java:464) 
  at java.nio.charset.Charset.forName(Charset.java:528) 
  at lucee.commons.io.CharsetUtil.toCharset(CharsetUtil.java:53) 
  at lucee.runtime.net.mail.MailClient.getConent(MailClient.java:548) 
  at lucee.runtime.net.mail.MailClient.getContent(MailClient.java:418) 
  at lucee.runtime.net.mail.MailClient.getContentEL(MailClient.java:392) 
  at lucee.runtime.net.mail.MailClient.toQuery(MailClient.java:330) 
  at lucee.runtime.net.mail.MailClient.getMessages(MailClient.java:377) 
  at lucee.runtime.net.mail.MailClient.getMails(MailClient.java:275) 
  at lucee.runtime.tag._Mail.doStartTag(_Mail.java:217) 
  at maintenance.testmail_cfm$cf.call(/maintenance/testmail.cfm:33) 
  at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:928) 
  at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:842) 
  at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:826) 
  at maintenance.application_cfc$cf.udfCall(/maintenance/Application.cfc:26) 
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) 
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:338) 
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:225) 
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:697) 
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:580) 
  at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1918) 
  at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:420) 
  at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:222) 
  at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:43) 
  at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2408) 
  at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2398) 
  at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2366) 
  at lucee.runtime.engine.Request.run(Request.java:34)

please always include version numbers when reporting an error :slight_smile:

Sorry Zac, I meant to update the post with more info but I got really into it trying to figure out what was causing it. Turns out it was the email header from a specific website throwing the error. They had programmatically added to the email header and did not include a line break, so “cfimap” didn’t know what the character encoding was for the email. I’m running the latest version (5) on a Windows 2008 server (IIS). I reached out to the owner of the site sending all the emails with the invalid headers to fix it, so for now it’s fine. Perhaps there could be some way for the cfimap tag to just disregard invalid headers, but if that’s too difficult to do, then I’ll have to disregard those that screw up their email headers.

1 Like

Glad you solved it, how long did you spend tracking down the problem?

perhaps Lucee could provide a better error message?