也许它不再是谷歌做的事情了!我有以下代码。
mail(from: @process_action.finance_case.case_owner.user.email, to: @process_action.finance_case.case_owner.user.email, subject: "Appointment") do |format|
format.ics {
ical = Icalendar::Calendar.new
e = Icalendar::Event.new
e.start = DateTime.now.utc
e.start.icalendar_tzid="UTC" # set timezone as "UTC"
e.end = (DateTime.now + 1.day).utc
e.end.icalendar_tzid="UTC"
e.organizer "any_email@example.com"
e.uid "MeetingRequest#{unique_value}"
e.summary "Scrum Meeting"
ical.add_event(e)
ical.publish
ical.to_ical
render :text => ical.to_ical
}
end
已尝试将内容类型设置为文本/日历和其他一些随机更改以查看是否有帮助。有人建议“方法”应该设置为请求谷歌识别但不确定如何或在哪里。
任何帮助/指示将不胜感激。或者即使它可以在 Outlook 中工作,因为这是客户端使用的。
更新:上面没有清除,但正在发送电子邮件。它的谷歌未能将其识别为事件邀请。
最佳答案
不是将 ics 信息作为格式块提供,对我有用的是将其作为附件添加到电子邮件中。然后 Gmail 将其显示为“此邮件中的事件”块下的附加事件:
# Generate the calendar invite
ical = Icalendar::Calendar.new
e = Icalendar::Event.new
...
ical.add_event(e)
ical.publish
# Add the .ics as an attachment
attachments['event.ics'] = { mime_type: 'application/ics', content: ical.to_ical }
# Generate the mail
mail(from: ..., to: ...)
关于ruby-on-rails - Ruby on Rails : Creating an email for an event using iCalendar. Google 无法识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20954499/