【问题标题】:Ruby on Rails: Creating an email for an event using iCalendar. Google does not recognise itRuby on Rails:使用 iCalendar 为事件创建电子邮件。谷歌无法识别
【发布时间】:2014-01-24 02:59:13
【问题描述】:

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

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

已尝试将内容类型设置为文本/日历和其他一些随机更改以查看是否有帮助。有人建议应该将“方法”设置为 REQUEST 以便 google 识别,但不确定如何或在哪里识别。

我们将不胜感激地收到任何帮助/指点。或者即使它可以在 Outlook 中工作,因为这是客户端使用的。

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

【问题讨论】:

  • 嗨,simon,你知道这个问题了吗?
  • 不,这是我客户最终不需要的东西。
  • 感谢西蒙的回复

标签: ruby-on-rails icalendar


【解决方案1】:

我没有将 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: ...)

【讨论】:

  • 谢谢。我会在接下来的几天内试一试并报告。
【解决方案2】:

您需要在发送邮件时致电.deliver!

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

【讨论】:

  • 感谢您的帮助。对不起,我是新手,我不清楚。我做.deliver!关于从该调用所在的方法返回的内容。正在发送电子邮件。问题是 Google 无法识别活动邀请。
猜你喜欢
  • 1970-01-01
  • 2023-03-28
  • 2011-10-08
  • 1970-01-01
  • 1970-01-01
  • 2013-09-30
  • 2019-11-28
  • 1970-01-01
  • 2016-10-09
相关资源
最近更新 更多