2016-07-29 7 views
0

Я работаю с Grails 3.x, особенно с плагинами электронной почты и iCalendar, я попытался подключить событие iCalendar к своей почтовой службе, но это не сработало. Я был бы очень признателен, если бы кто-то помог мне исправить мой код. Вот оно:Прикрепите событие iCalendar к письму в Grails

** Эта часть моя структура ** Анонсы https://github.com/saw303/grails-ic-alender

byte[] iCalendarFile 
{ 
    render(contentType: 'text/calendar') 
    { 
     calendar 
     { 
      events { 
       event(
        start: new Date(), 
        end: new Date(), 
        description: 'Event', 
        summary: 'Some text here', 
       ) 
      } 
     } 
    } 
    calendar.toString.getBytes('UTF-8') 
} 

** А то у меня есть мой адрес электронной структуры **

def mailService 

def emailSender() 
{ 
    mailService.sendMail 
    { 
     multipart true 
     to correo 
     subject "Event" 
     body "Some text here" 
     attach "audiencia.ics", "text/calendar", iCalendarFile() 
    } 
} 

Оба iCalendarFile и EmailSender находятся в тот же класс обслуживания.

Спасибо за поддержку yout. :)

ответ

0

Это ответ

import ch.silviowangler.grails.icalender.ICalendarBuilder 

class NotifierService 
{ 
    byte[] emailFile (**params**) 
    { 
     def archivo = new ICalendarBuilder() 
     archivo.calendar { 
      events { 
       event(start: new Date(), 
        end: new Date(), 
        description: "Description", 
        summary: "Some text here", 
        utc: true // optional 
       ) 
      } 
     } 
     archivo.cal.toString().getBytes('UTF-8') 
    } 

mailService.sendMail 
{ 
    multipart true 
    to [email protected] 
    subject "Subject" 
    body "Some text here" 
    attach "event.ics", "text/calendar", emailFile(**params**) 
} 

 Смежные вопросы

  • Нет связанных вопросов^_^