We have have MIME message whose body part is as below
Content-Type: text/rfc822-headers; Content-Transfer-Encoding: 8bit
The two headers 'Content-Type' and 'Content-Transfer-Encoding' are in the same line.
When we get the content type from body part it is coming as 'text/rfc822-headers; Content-Transfer-Encoding: 8bit'
and when we use the same in other places as below it is throwing the error 'javax.mail.internet.ParseException'
ContentType ct = new ContentType(contentType);
When I move the same to separate lines as below then its parsed successfully.
Is it against the MIME standard, is there any property to set to ignore these kind of MIME issues?.
Yes, it's very clearly against the MIME spec.
You can browse all the properties in the javadocs for the javax.mail.internet package.
There are some that you can set that might help with this. But at some point the message
will be so broken that there's nothing reasonable you can do with it.
It's possible to supply your own class that will "clean up" the Content-Type header
before it's used, so if you think you know how to do this better than JavaMail, you can
write your own code to do so.
But you'll need a recent version of JavaMail to use all these features.
It is, of course, much better to fix the mailer that's sending this garbage.
That's the real source of the problem, not JavaMail.