我在rails中使用icalendar gem在通过rails应用程序发送邮件时在会议邀请中呈现日历。
这是我的代码:
mails = mail(:from => "organizer@email.com",:to => "organizer@email.com,recipient@email.com",:subject => "subject") do |format|
format.html { render "my_content_partial" }
format.ics {
ical = Icalendar::Calendar.new
ical.custom_property("X-MS-OLK-FORCEINSPECTOROPEN", "TRUE")
e = Icalendar::Event.new
e.start = DateTime.parse(start_time)
e.start.icalendar_tzid="UTC"
e.end = DateTime.parse(end_time)
e.end.icalendar_tzid="UTC"
e.klass "PRIVATE"
e.organizer "organizer@email.com"
e.attendees ["mailto: my@email.com"]
e.summary "#{subject}" #builds the title of the meeting in calendar
e.custom_property("LOCATION", "my location")
ical.add_event(e)
ical.custom_property("METHOD", "REQUEST")
render :text => ical.to_ical
}
mails.deliver
我面临的问题是发送到recipient@email.com的电子邮件中包含日历,但没有显示在organizer@email.com的电子邮件中。 提前谢谢。