标准Grails邮件插件Mail-Plugin
用于创建ICal文件的ICal插件I-Cal-Plugin
我已经非常轻松地成功使用邮件,附加文件等,然而,让Ical与来自attachBytes
的{{1}}一起工作证明是困难的
mail plugin
要附加您使用的sendMail {
multipart true
to test@test.com
subject "whatever..."
html g.render(template:"/emails/Attendees", model:[ instance: inst])
inline "banner", "image/jpeg", new File("./web-app/images/emailTemplates/email_banner.png")
inline "footer", "image/jpeg", new File("./web-app/images/emailTemplates/lEdvn.png")
}
文件,我尝试使用attachBytes
render
函数
ical docs
def ical = render(contentType: 'text/calendar', filename: '<optional filename>') {
calendar {
events {
event(start: Date.parse('dd.MM.yyyy HH:mm', '31.10.2009 14:00'),
end: Date.parse('dd.MM.yyyy HH:mm', '31.10.2009 15:00'),
description: 'Events description',
summary: 'Short info1') {
organizer(name: 'Silvio Wangler', email: 'a@b.com')
}
}
}
}
在技术上无关紧要,即在到达此代码块时立即下载。我们的想法是保存并附加到电子邮件中,无需下载。
感谢您的时间
答案 0 :(得分:2)
任何偶然发现这篇文章的人都是答案:
def builder = new ICalendarBuilder()
builder.calendar {
events {
event(start: new Date(), end: (new Date()).next(), summary: 'Text') {
organizer(name:'Silvio', email:'test@test.com')
reminder(minutesBefore: 15, description: 'Alarm 123')
}
}
}
然后,对于电子邮件sendMail
功能添加:
attachBytes "appointment.ics", "text/calendar", builder.cal.toString().getBytes('UTF-8')