Ruby ICalendar Gem: How to get e-mail reminders working.

Posted by Jenny on Stack Overflow See other posts from Stack Overflow or by Jenny
Published on 2010-04-29T22:26:18Z Indexed on 2010/04/29 22:27 UTC
Read the original article Hit count: 340

Filed under:
|
|
|

I'm trying to work out how to use the icalendar ruby gem, found at:

http://icalendar.rubyforge.org/

According to their tutorial, you do something like:

  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

So, I am doing something similar in my code.

  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

However, I never see any e-mail sent to my account... I have even tried hard coding the start times to be Time.now, and sending them out 0 minutes before, but no luck... Am I doing something glaringly wrong?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about gems