Uploaded image for project: 'Commons Email'
  1. Commons Email
  2. EMAIL-137

MimeMessageParser throws ClassCastException for HtmlEmail

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 1.3.3
    • Labels:
      None
    • Environment:

      Java 1.6 + Scala 2.10.3 + Play! 2.2.2

      Description

      MimeMessageParser throws ClassCastException when parsing just created and built HtmlEmail:

      java.lang.ClassCastException: javax.mail.internet.MimeMultipart cannot be cast to java.lang.String
      at org.apache.commons.mail.util.MimeMessageParser.parse(MimeMessageParser.java:176) ~[commons-email-1.3.2.jar:1.3.2]
      at org.apache.commons.mail.util.MimeMessageParser.parse(MimeMessageParser.java:85) ~[commons-email-1.3.2.jar:1.3.2]
      at utils.EmailSender$.emailForAutomation(EmailSender.scala:382) ~[classes/:na]

      Here is the test code:

      def emailForAutomation(email: HtmlEmail): String = {

      email.buildMimeMessage()
      val mimeMessage = email.getMimeMessage()

      val parser = new MimeMessageParser(mimeMessage)
      parser.parse()

      parser.getHtmlContent()
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alboko Alex Kogan
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: