ruby-on-rails - Ruby on Rails : Creating an email for an event using iCalendar. Google 无法识别

标签 ruby-on-rails icalendar

也许它不再是谷歌做的事情了!我有以下代码。

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/

相关文章:

ruby-on-rails - 跟踪/记录 ActiveRecord 回调

asp.net-mvc-3 - 如何删除不需要的 WWW-Authenticate header

ios - UIDocumentInteractionController 日历访问

Java iCalendar 在 Outlook 中免费邀请

ruby-on-rails - react-rails Assets 管道图像路径

ruby-on-rails - Paypal - 使用 Rails 定期计费(适用于非美国商家)

javascript - 从 Google map 中删除控件

ruby-on-rails - 使用货币 rails : How to manually set an attribute's currency

java - iCal4J 生成的 Outlook 无法识别 .ics 文件中的时区

datetime - iCAL DTSTART 和 DTEND 格式混淆。应该很容易回答