According to the documentation, the problem is the Content-Type parameter structure, ti should be:
Content-Type: text/rfc822-headers; Content-Transfer-Encoding= 8bit
I have just created a class to fix it, but still I think there must be some better solution. If someone finds it, please keep answering! :)
Thanks
public static String cleanContentType(String contentType){
StringBuilder cleanedContentType = new StringBuilder();
if(contentType.contains(";")){ //It contains paramenter
cleanedContentType.append(contentType.split(";")[0]).append("; ");
if(contentType.split(";").length > 1){
for(int i = 1; i < contentType.split(";").length ; i++){
cleanedContentType.append(contentType.split(";")[i].replace(":", "=")).append("; ");
}
}
} else{
return contentType;
}
return cleanedContentType.toString();
}