title: IllegalStateException when sending multipart mail from tomcat6
body: <p>I'm sending multipart mails with attachment from my grails application using the <a href="http://grails.org/plugin/mail" rel="nofollow">mail plugin</a>.</p>
  
  <p>On my local machine (Mac OS X) all works fine. If I deploy my app to tomcat6 (Ubuntu - ) the mail could not be sent due to an <code>IllegalStateException</code>:</p>
  
  <pre><code>Stacktrace follows: 
     java.lang.IllegalStateException: Not in multipart mode - 
     create an appropriate MimeMessageHelper via a constructor that takes a 'multipart' 
     flag if you need to set alternative texts or add inline elements or attachments. 
        at grails.plugin.mail.MailMessageBuilder.doAdd(MailMessageBuilder.groovy:347) 
        at grails.plugin.mail.MailMessageBuilder.attach(MailMessageBuilder.groovy:308) 
        at grails.plugin.mail.MailMessageBuilder.attach(MailMessageBuilder.groovy:284) 
        at grails.plugin.mail.MailMessageBuilder.attachBytes(MailMessageBuilder.groovy:280)
        ...
  </code></pre>
  
  <p>Simple mails (not multipart) could be sent from tomat6 successfully.</p>
  
  <p>Here is my code for sending multipart mails:</p>
  
  <pre><code>mailService.sendMail {
     multipart true
     to mail
     subject mySubject
     body (view: myView, model: myModel)
     attachBytes "${myTitle}.pdf", CH.config.grails.mime.types['pdf'], myBytes
  } 
  </code></pre>
  
  <p>What can I do to avoid these Exception?</p>
  
  <p>Where is the underlying JavaMail lib located? Is it packed into war file? </p>
  
  <p>How can I find out which version of JavaMail is used within my tomcat6 and on my local machine?</p>