Skip to content

Hooking up email for reminders

jamesu edited this page Sep 12, 2010 · 4 revisions

Introduction

Hooking up the email dispatch for Reminders is quite simple. The only problem is that the mechanism for dispatching the emails to to SMTP or Sendmail (or whatever you use) is undefined, so you need to implement that part yourself.

Generally, you’ll want to make a cron script which in essence runs the following:


script/runner -e production "Reminder.dispatch_and_clean()"

I suggest looking at the configuration section in HowToSendEmailsWithActionMailer on the rails wiki for configuring ActionMailer.

An example is as follows, which should be placed in “config/app_config.yml” :


email:
  delivery: smtp
  
  # For SMTP
  smtp:
    address: localhost
    domain: localhost
    username: myuser
    password: mypass
    authentication: login

  # For sendmail
  sendmail:
    location: "/usr/sbin/sendmail"
    arguments: "-t -t"

How the Reminders work

Every time Reminder.dispatch_and_clean() is called, RuckSack does the following:

  • Deletes reminders which have expired (i.e. have been sent and are more than 2 days old)
  • Sends reminders via email which are due
  • Re-schedules reminders which are repeatable

As you may have noticed before, reminders that are more than a day old are not included in the reminders list in the web interface. Consequently, if you make a load of reminders and don’t dispatch them, they will pile up. When you come to send them, they will all be sent – so beware!