Ricardo Umpierrez
Ricardo Umpierrez

Reputation: 768

JavaMail MimeMessage.getContent unsupported encoding

I´m having a problem with parsing some type of mail encoding with charset=t.101-g2

I´m using JavaMail in Grails directly using the lib, getting the unread emails from IMAP, and for each message try to get the content with Object msgContent = msg.getContent()

And that line is throwing the error.

The exception

java.io.UnsupportedEncodingException: t.101-g2 [See nested exception: java.io.UnsupportedEncodingException: t.101-g2
    at java.io.InputStreamReader.<init>(InputStreamReader.java:100)
    at com.sun.mail.handlers.text_plain.getContent(text_plain.java:107)
    at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:790)
    at javax.activation.DataHandler.getContent(DataHandler.java:537)
    at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1453)

The mail is like :

Content-Transfer-Encoding: 8bit
From: "Some Email" <[email protected]>
Content-type: text/plain; charset=t.101-g2
Subject: SomeSubject
Date: Fri, 12 Jun 2015 06:55:36 -0500
X-Source: /usr/local/cpanel/bin/autorespond
X-Source-Args: /usr/local/cpanel/bin/autorespond [email protected] /home/oriental/.autorespond 
X-Source-Dir: /home/oriental

Some Text

Upvotes: 0

Views: 1769

Answers (1)

Related Questions