Ruby on rails RubyonRails:使用iCalendar为事件创建电子邮件。谷歌不承认这一点

Ruby on rails RubyonRails:使用iCalendar为事件创建电子邮件。谷歌不承认这一点,ruby-on-rails,icalendar,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.

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

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
尝试将内容类型设置为text/calendar和randon的其他一些更改,看看是否有帮助。有人建议将“方法”设置为请求谷歌识别,但不确定如何识别或在何处识别

如有任何帮助/建议,将不胜感激。或者即使它可以在Outlook中工作,因为这是客户端使用的


更新:不清除以上内容,但电子邮件正在发送。谷歌未能将其识别为活动邀请。

您需要拨打
.deliver在您的邮件发送中

mail(to: 'thisguy', from: 'thatguy', subject: 'Hey').deliver!

与其将ics信息作为一个格式块提供,我的工作方式是将其作为附件添加到电子邮件中。然后,Gmail将其显示为“此消息中的事件”块下的附加事件:

#生成日历邀请
ical=Icalendar::Calendar.new
e=Icalendar::Event.new
...
ical.添加事件(e)
出版
#将.ics添加为附件
附件['event.ics']={mime_-type:'application/ics',内容:ical.to_-ical}
#生成邮件
邮件(发件人:…,收件人:…)

谢谢您的帮助。对不起,我是新手,我不太清楚。我来做,送!位,说明此调用所在的方法返回的内容。正在发送电子邮件。问题是谷歌没有意识到活动邀请。谢谢。我将在未来几天内试一试,并向您汇报。嗨,西蒙,您解决了这个问题吗?不,这是我客户最终不需要的。谢谢您的回复,西蒙