Mail Plugin

Attachments issue

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: Grails-Mail-0.9
  • Component/s: None
  • Labels:
    None
  • Environment:
    ubuntu, Idea, Grails 1.1.1, Mail plugin 0.6

Description

I am trying to use attachments with Mail plugin 0.6 on Grailsl 1.1.1 and I get this exception:
Any idea?

Thank you, Ladislav.

2009-05-19 11:25:09,964 [http-8081-1] ERROR errors.GrailsExceptionResolver - groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.springframework.mail.javamail.MimeMessageHelper(org.springframework.mail.javamail.MimeMailMessage, java.lang.Boolean, java.lang.String)
org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.springframework.mail.javamail.MimeMessageHelper(org.springframework.mail.javamail.MimeMailMessage, java.lang.Boolean, java.lang.String)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:847)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Caused by: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.springframework.mail.javamail.MimeMessageHelper(org.springframework.mail.javamail.MimeMailMessage, java.lang.Boolean, java.lang.String)
at org.grails.mail.MailMessageBuilder.attachBytes(MailMessageBuilder.groovy:80)
at CustomerInvoiceController$_closure9_closure14.doCall(CustomerInvoiceController.groovy:162)
at CustomerInvoiceController$_closure9_closure14.doCall(CustomerInvoiceController.groovy)
at org.grails.mail.MailService.sendMail(MailService.groovy:42)
at org.grails.mail.MailService$sendMail.call(Unknown Source)
at MailGrailsPlugin$_configureSendMail_closure4.doCall(MailGrailsPlugin.groovy:85)
at CustomerInvoiceController$_closure9.doCall(CustomerInvoiceController.groovy:156)
at CustomerInvoiceController$_closure9.doCall(CustomerInvoiceController.groovy)
... 32 more

  1. mail-plugin.patch
    28/Jul/09 3:28 PM
    2 kB
    Stefan Armbruster
  2. patch_for_multipart_messages.patch
    02/Aug/09 3:23 PM
    3 kB
    Stefan Armbruster

Activity

Hide
jorge added a comment -
Show
jorge added a comment - related http://jira.codehaus.org/browse/GRAILSPLUGINS-1081
Hide
john added a comment -

I think that

this

// MimeMessageHelper message = new MimeMessageHelper(msg, true, "UTF-8");

should be:

MimeMessageHelper helper = new MimeMessageHelper(msg.getMimeMessage(), true, "UTF-8")

Show
john added a comment - I think that this // MimeMessageHelper message = new MimeMessageHelper(msg, true, "UTF-8"); should be: MimeMessageHelper helper = new MimeMessageHelper(msg.getMimeMessage(), true, "UTF-8")
Hide
Stefan Armbruster added a comment -

patch & unit test fixing that issue

Show
Stefan Armbruster added a comment - patch & unit test fixing that issue
Hide
Stefan Armbruster added a comment -

I've just submitted a patch for this containing a unit test. It would be very helpful, if this could be applied soon and a new release of the plugin could be created.
Thx, Stefan

Show
Stefan Armbruster added a comment - I've just submitted a patch for this containing a unit test. It would be very helpful, if this could be applied soon and a new release of the plugin could be created. Thx, Stefan
Hide
Stefan Armbruster added a comment -

Updated version of previous patch. In order to have both, body and attachments in an email, you need to tell MimeMessageHelper at construction time, that we're dealing with a multipart message.
Therfore I introdruced the 'multipart' method in the builder. NB: if multipart is used, it has to be the very first DSL statement:

sendMail {
    multipart true
    to issue.watchers.email.toArray()
    subject "The issue you watch has been updated"
    body "Hello Watcher!"
    attachBytes "Some-File-Name.xml", "text/xml", contentOrder.getBytes("UTF-8")
}
Show
Stefan Armbruster added a comment - Updated version of previous patch. In order to have both, body and attachments in an email, you need to tell MimeMessageHelper at construction time, that we're dealing with a multipart message. Therfore I introdruced the 'multipart' method in the builder. NB: if multipart is used, it has to be the very first DSL statement:
sendMail {
    multipart true
    to issue.watchers.email.toArray()
    subject "The issue you watch has been updated"
    body "Hello Watcher!"
    attachBytes "Some-File-Name.xml", "text/xml", contentOrder.getBytes("UTF-8")
}

People

Vote (3)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: