6 Replies Latest reply on Sep 23, 2011 2:45 AM by nathan dennis

    Seam 2.2.0.GA Mail MIME Attachment IS NOT TO SPEC

    nathan dennis Expert

      I have multiple Enterprise Systems deployed.. all using Seam 2.2.0.GA on Jboss AS..
      All have worked flawlessly sending PDF's in emails for a long time. (some of the code is years old now)
      Thunderbird clients can no longer view these messages because Seams is setting the content type MIME to related. And while this is correct for inline objects, boys we got a serious problem with PDF's. Should be set to mixed to handle non graphics objects not displayed inline.

      And believe me,, i dont want to touch anything in my well oiled machine,,, talked to those nuts over at mozilla about them screwing up backwards compatibility... they pretty much send me a list of things not to do on their forum... number 1 of course being not to disagree with any of their decisions. so the truth of it is,,, ive got a problem with archived emails incorrectly formatted. and ive got an even bigger problem with seams continuing to generate emails that those who chose to adhere to the spec, wont read. 

      RFC2387 Spec

      should i even bother to file a bug report? would this be fixed in this version if i did?

      the offending bit of code is in UIBody.java

                          MimeMultipart bodyRootMultipart = new MimeMultipart("related");
                            //MimeMultipart bodyRootMultipart = new MimeMultipart("mixed");
                          bodyRootMultipart.addBodyPart(bodyPart, 0);
                          for (MimeBodyPart attachment: findMessage().getAttachments())
                          bodyPart = new MimeBodyPart();

      simply switching it to mixed makes these PDF's show up again.. and breaks all the inline images. (image will be attached at the bottom,, which in a formatted email blast goes over about like a fart in a diving helmet)

      i tried to just capture the type of attachment and adjust the MIME type for the PDF's.. pretty sure that is how this should work, but im not familiar enough with the workings and structure of messages to succeed on my own.
      Please help if you can, because this whole situation is spiraling from bad to really sucks in a hurry.

        • 2. Re: Seam 2.2.0.GA Mail MIME Attachment IS NOT TO SPEC
          nathan dennis Expert

          Yes.. was my first thought too... but on closer inspection the Source UIAttachment.java

             private String disposition = "attachment";

          so it is set to that behavior by default.. it will change the disposition to inline if you set it to that. but that doesnt have any effect in the multipart/related parent

          Message-ID: <1992253538.401315329484805.JavaMail.jboss@node1>
          Subject: Online Credit Application
          MIME-Version: 1.0
          Content-Type: multipart/mixed; 
          X-Priority: 5
          Priority: Non-urgent
          Importance: low
          X-Sent-From: Node1
          Date: Tue,  6 Sep 2011 13:18:04 -0400 (EDT)
          Content-Type: multipart/related;            (***********************PROBLEM IS HERE*********************)
          Content-Type: text/html; charset=ISO-8859-1
          Content-Transfer-Encoding: 7bit
          Content-Disposition: inline
          Content-Type: application/pdf; name=XXXXXXXXXXX.pdf
          Content-Transfer-Encoding: base64
          Content-ID: <aeamddeazitbtngdcsln>
          Content-Disposition: attachment; filename=XXXXXXXXXXX.pdf

          the more i think about it.. im starting to realize why the Seam Guys wrote it this way as switching between mixed and related can get difficult to keep track of. but unfortunately, there is this poorly written spec that developers were all but ignoring in exchange for convention up until this last week when Thunderbird pushed non backward compatible code on its user base because the above convention of mixing attachment types isnt technically correctly formatted.

          where is the buzz on this forum??? i remember the old days when i would have been swamped with responses from gavin and pete for a question like this... thanks for your time Aldo

          • 3. Re: Seam 2.2.0.GA Mail MIME Attachment IS NOT TO SPEC
            nathan dennis Expert

            i would really appreciate one of the developers to address this topic at least on the forum.

            • 4. Re: Seam 2.2.0.GA Mail MIME Attachment IS NOT TO SPEC
              Aldo Bonzi Novice

              Well, as you point it out, the forum is certainly not what is was so I think you would be more than lucky if you get the their attention in the short time. Maybe a JIRA could help.

              In the mean time, I've tried to reproduce your problem but I wasn't able.


              <m:message xmlns="http://www.w3.org/1999/xhtml"
                  <m:to name="Aldo Bonzi" address="xxx@xxx.com"/>
                  <m:from name="Seam test project" address="xxx@xxx.com"/>
                  <m:subject>SEAM Test</m:subject>
                  <m:attachment fileName="tiny.pdf">
                     A very tiny PDF                                                                                              
                  <m:attachment value="/img/seamlogo.png"
                       SEAM Test
                       <img src="cid:#{seamphoto.contentId}" />

              Seems to work in:

              • Thunderbird 3.1.13

              • Ubuntu 11.04

              • Seam 2.2.1.Final (Did not try in 2.2.0.GA)

              • 5. Re: Seam 2.2.0.GA Mail MIME Attachment IS NOT TO SPEC
                nathan dennis Expert

                well that is easy to explain... Thunderbird didnt start following the spec until 5.x. TB 6.0 for sure will reproduce this problem. you can also verify that what i said is true by looking at the message source code.

                • 6. Re: Seam 2.2.0.GA Mail MIME Attachment IS NOT TO SPEC
                  nathan dennis Expert

                  IM A MAMAMA-MORON!!


                  i dont know how i missed that 3 weeks ago when i was hunting for info on this bug. i actually found it after i filed the bug report and had to go cancel the issue.

                  this mess is fixed in 2.2.1.CR2. i will be moving to FINAL though i have 2.2.0.GA in production in about 4 sites right now. i cant get over the inactivity on this forum though. thanks for looking at this mess... i think its just the two of us. (listens to his echo)