开发者

Mailing with attachment

开发者 https://www.devze.com 2023-01-22 07:01 出处:网络
I have my application sending mail on click of a link./ Any way that i can customize this app to send mail with an attachment.

I have my application sending mail on click of a link./

Any way that i can customize this app to send mail with an attachment.

Belwo is my controller code and service code

Controller code

 def list = {
    params.max = Math.min(params.max ? params.int('max') : 10, 100)
    [challengeInstanceList: Challenge.list(params), challengeInstanceTotal: Challenge.count()]
}

Service Code:'

def mailTest() {
  println("in service")
  mailService.sendMail { 
   multipart true
   to "d@gton.com"
   from "d@gton.com"
   cc "d@gton.com"
   bcc "d@gton.com"
   开发者_开发知识库subject "Test Mail"
   body 'Test Mail.'

} }

Any Inputs??


You can add attachments with:

mailService.sendMail { 
 multipart true
 attachBytes "Some-File-Name.xml", "text/xml", contentOrder.getBytes("UTF-8")

There is a description of it in the Plugin documentation

0

精彩评论

暂无评论...
验证码 换一张
取 消