You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Olaf K. (JIRA)" <ji...@apache.org> on 2013/10/09 16:06:43 UTC
[jira] [Created] (EMAIL-134) TXT-Attachment disappeared
Olaf K. created EMAIL-134:
-----------------------------
Summary: TXT-Attachment disappeared
Key: EMAIL-134
URL: https://issues.apache.org/jira/browse/EMAIL-134
Project: Commons Email
Issue Type: Bug
Affects Versions: 1.3.1
Environment: Thunderbird, James 3.0 beta4
Reporter: Olaf K.
After parsing an HTML-EMail with an txt-Attachment, I receive for
parser.getHtmlContent(); -> the html-body -> ok
parser.getPlainContent() -> the content of the txt-attchment -> nok
parser.getAttachmentList(); -> empty list -> nok
I identified the cause of the problem in the class MimiMessageParser.
{code}
protected void parse(Multipart parent, MimePart part){
if (part.isMimeType("text/plain") && (plainContent == null) && filename == null) {
plainContent = (String) part.getContent();
} else {
if (part.isMimeType("text/html") && (htmlContent == null)) {
htmlContent = (String) part.getContent();
} else {
...
{code}
If the plainContent is not set, then every "text/plain"-type is used for the content.
My solution looks like this:
{code}
protected void parse(Multipart parent, MimePart part) throws MessagingException, IOException {
String filename = part.getFileName();
if (part.isMimeType("text/plain") && (plainContent == null) && filename == null) {
plainContent = (String) part.getContent();
} else {
if (part.isMimeType("text/html") && (htmlContent == null)) {
htmlContent = (String) part.getContent();
} else {
...
{code}
Please check this issue.
Thx in advance.
--
This message was sent by Atlassian JIRA
(v6.1#6144)