2010-04-29 49 views
0

我试图找出如何使用的iCalendar红宝石的宝石,在发现:红宝石的iCalendar宝石:如何得到电子邮件提醒工作

http://icalendar.rubyforge.org/

根据他们的教程,你做的东西像:

cal.event.do 
# ...other event properties 
alarm do 
    action  "EMAIL" 
    description "This is an event reminder" # email body (required) 
    summary  "Alarm notification"  # email subject (required) 
    attendees  %w(mailto:[email protected] mailto:[email protected]) # one or more email recipients (required) 
    add_attendee "mailto:[email protected]" 
    remove_attendee "mailto:[email protected]" 
    trigger  "-PT15M" # 15 minutes before 
    add_attach "ftp://host.com/novo-procs/felizano.exe", {"FMTTYPE" => "application/binary"} # email attachments (optional) 
end 

alarm do 
    action  "DISPLAY" # This line isn't necessary, it's the default 
    summary  "Alarm notification" 
    trigger  "-P1DT0H0M0S" # 1 day before 
end 

alarm do 
    action  "AUDIO" 
    trigger  "-PT15M" 
    add_attach "Basso", {"VALUE" => ["URI"]} # only one attach allowed (optional) 
end 

所以,我在做我的代码类似的东西。

def schedule_event 
    puts "Scheduling an event for " + self.title + " at " + self.start_time 
     start = self.start_time 
     endt = self.start_time 
     title = self.title 
     desc = self.description 
     chan = self.channel.name 
     # Create a calendar with an event (standard method) 
     cal = Calendar.new 
     cal.event do 
     dtstart  Program.convertToDate(start) 
     dtend   Program.convertToDate(endt) 
     summary  "Want to watch" + title + "on: " + chan + " at: " + start 
     description desc 
     klass  "PRIVATE" 
     alarm do 
      action  "EMAIL" 
      description desC# email body (required) 
      summary  "Want to watch" + title + "on: " + chan + " at: " + start  # email subject (required) 
      attendees  %w(mailto:[email protected]) # one or more email recipients (required) 
      trigger  "-PT25M" # 25 minutes before 
     end 

     end 

但是,我从来没有看到任何电子邮件发送到我的账户......我甚至尝试硬编码的开始时间是Time.now,0分钟,然后送他们,但没有运气。 ..我做了一件明显错误的事情吗?

回答

2

iCalendar Gem不会处理通知发送 - 报警只是一个概念 in ical。你必须实现你自己的服务,它分派电子邮件通知并附加生成的ical数据。

+0

男人,完全被误解,然后.... – Jenny 2010-04-29 23:04:02

1

http://icalendar.rubyforge.org/上的报警示例只是让iCal/Outlook知道应在事件上设置闹​​钟,并且该应用程序(ical/outlook)从该点开始处理它。

与在iCal上创建事件并设置闹钟几乎相同。

所以iCalendar不会发送通知,iCal/outlook会。

以防万一其他人发现这一点。