[
https://issues.apache.org/jira/browse/EMAIL-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Neidhart resolved EMAIL-129.
-----------------------------------
Resolution: Invalid
Dear Oliver,
you have to call
{noformat}
emailParser.parse();
{noformat}
before you can access the content or test whether the raw email has plain or
html content.
Closing this issue as invalid.
> hasPlainContent and hasHtmlContent both return false
> ----------------------------------------------------
>
> Key: EMAIL-129
> URL: https://issues.apache.org/jira/browse/EMAIL-129
> Project: Commons Email
> Issue Type: Bug
> Affects Versions: 1.3.1
> Environment: Ubuntu Linux 12 LTS, OpenJDK 7
> Reporter: Oliver Kohll
>
> Using the following code
> InputStream is = new ByteArrayInputStream(rawEmail.getBytes());
> MimeMessage message = new MimeMessage(s, is);
> MimeMessageParser emailParser = new MimeMessageParser(message);
> if (emailParser.hasPlainContent()) {
> logger.debug(emailParser.getPlainContent());
> } else if (emailParser.hasHtmlContent()) {
> logger.debug(emailParser.getHtmlContent());
> } else {
> throw new Exception("No content found for email");
> }
> the Exception is thrown for sample rawEmail:
> Return-Path: <[email protected]>
> X-Original-To: [email protected]
> Delivered-To: [email protected]
> Received: from [192.168.1.5] (unknown [88.211.41.14])
> by li349-29.members.linode.com (Postfix) with ESMTPSA id D63B05AE4F7;
> Thu, 25 Jul 2013 12:03:29 +0100 (BST)
> From: Oliver Kohll <[email protected]>
> Content-Type: multipart/alternative;
> boundary="Apple-Mail=_E3FC6CFD-A540-4365-BA9C-6DDC7A28F052"
> Subject: test
> Date: Thu, 25 Jul 2013 12:03:31 +0100
> Message-Id: <[email protected]>
> Cc: "[email protected]" <[email protected]>
> To: "[email protected]" <[email protected]>
> Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\))
> X-Mailer: Apple Mail (2.1508)
> --Apple-Mail=_E3FC6CFD-A540-4365-BA9C-6DDC7A28F052
> Content-Transfer-Encoding: 7bit
> Content-Type: text/plain;
> charset=us-ascii
> test content
> www.agilebase.co.uk / 0117 321 0104 / 07814 828608
> www.twitter.com/agilebase
> --Apple-Mail=_E3FC6CFD-A540-4365-BA9C-6DDC7A28F052
> Content-Transfer-Encoding: quoted-printable
> Content-Type: text/html;
> charset=us-ascii
> <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
> charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
> -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">test =
> content<br><div apple-content-edited=3D"true">
> <div style=3D"color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
> medium; font-style: normal; font-variant: normal; font-weight: normal; =
> letter-spacing: normal; line-height: normal; orphans: 2; text-align: =
> -webkit-auto; text-indent: 0px; text-transform: none; white-space: =
> normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; =
> -webkit-text-stroke-width: 0px; word-wrap: break-word; =
> -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div =
> style=3D"color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; =
> font-style: normal; font-variant: normal; font-weight: normal; =
> letter-spacing: normal; line-height: normal; orphans: 2; text-align: =
> -webkit-auto; text-indent: 0px; text-transform: none; white-space: =
> normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; =
> -webkit-text-stroke-width: 0px; word-wrap: break-word; =
> -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span =
> class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
> rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: =
> normal; font-weight: normal; letter-spacing: normal; line-height: =
> normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; =
> text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; =
> border-spacing: 0px; -webkit-text-decorations-in-effect: none; =
> -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
> font-size: medium; "><div style=3D"word-wrap: break-word; =
> -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span =
> class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
> rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: =
> normal; font-weight: normal; letter-spacing: normal; line-height: =
> normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; =
> text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; =
> border-spacing: 0px; -webkit-text-decorations-in-effect: none; =
> -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
> font-size: medium; "><div style=3D"word-wrap: break-word; =
> -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span =
> class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
> rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: =
> normal; font-weight: normal; letter-spacing: normal; line-height: =
> normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; =
> text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; =
> border-spacing: 0px; -webkit-text-decorations-in-effect: none; =
> -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
> font-size: medium; "><div style=3D"word-wrap: break-word; =
> -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span =
> class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
> rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: =
> normal; font-weight: normal; letter-spacing: normal; line-height: =
> normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; =
> text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; =
> border-spacing: 0px; -webkit-text-decorations-in-effect: none; =
> -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
> font-size: medium; "><div style=3D"word-wrap: break-word; =
> -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span =
> class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
> rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: =
> normal; font-weight: normal; letter-spacing: normal; line-height: =
> normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: =
> normal; widows: 2; word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-style: normal; font-variant: normal; font-weight: =
> normal; letter-spacing: normal; line-height: normal; orphans: 2; =
> text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
> word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
> style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-size: medium; font-style: normal; font-variant: normal; =
> font-weight: normal; letter-spacing: normal; line-height: normal; =
> orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; =
> widows: 2; word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; "><div style=3D"word-wrap: =
> break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
> after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-size: medium; font-style: normal; font-variant: normal; =
> font-weight: normal; letter-spacing: normal; line-height: normal; =
> orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; =
> widows: 2; word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; "><div style=3D"word-wrap: =
> break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
> after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-size: medium; font-style: normal; font-variant: normal; =
> font-weight: normal; letter-spacing: normal; line-height: normal; =
> orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; =
> widows: 2; word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; "><div style=3D"word-wrap: =
> break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
> after-white-space; "><span class=3D"Apple-style-span" =
> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
> Helvetica; font-size: medium; font-style: normal; font-variant: normal; =
> font-weight: normal; letter-spacing: normal; line-height: normal; =
> orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; =
> widows: 2; word-spacing: 0px; border-spacing: 0px; =
> -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
> auto; -webkit-text-stroke-width: 0px; "><span class=3D"Apple-style-span" =
> style=3D"font-size: 12px; "><div><br =
> class=3D"Apple-interchange-newline"><a =
> href=3D"http://www.agilebase.co.uk">www.agilebase.co.uk</a> / 0117 321 =
> 0104 / 07814 828608</div><div><a =
> href=3D"http://www.twitter.com/agilebase">www.twitter.com/agilebase</a></d=
> iv></span></span></div></span></div></span></div></span></div></span></div=
> ></span></div></span></div></span></div></span></div></span></div></span><=
> /div></span></div></span></div></span></div></span></div></span></div></sp=
> an></div></span></div></span></div></span></div></div>
> </div>
> <br></body></html>=
> --Apple-Mail=_E3FC6CFD-A540-4365-BA9C-6DDC7A28F052--
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira