Sim*_*ley 6 icalendar ruby-on-rails
也许它不是谷歌做的东西了!我有以下代码.
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
Run Code Online (Sandbox Code Playgroud)
尝试将内容类型设置为文本/日历以及其他一些randon更改以查看是否有帮助.有人建议将'方法'设置为REQUEST以供谷歌识别但不确定如何或在何处.
我们将非常感激地收到任何帮助/指示.或者即使它可以在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: ...)
Run Code Online (Sandbox Code Playgroud)
One*_*ude -1
您需要调用.deliver!您的邮件发送功能。
mail(to: 'thisguy', from: 'thatguy', subject: 'Hey').deliver!
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2048 次 |
| 最近记录: |