Skip to content

Hooking up email for pages

jamesu edited this page Sep 12, 2010 · 1 revision

Introduction

Hooking up the email controller (Mailman) in order to create content on pages via email is quite simple. The only problem is that the mechanism for pulling in the emails to Rucksack is undefined, so it is up to you to implement that part.

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


Mailman.receive(email_content)

I suggest looking at HowToReceiveEmailsWithActionMailer on the rails wiki for suggestions on how to hook such a script up to Mailman.

Email usage

Generally, there are two things that can happen to an email going into Mailman:

  • It gets handled by a custom “process_#{widget_type}” handler
  • If all else fails, it just gets added to the page

The widget_type is parsed by a regular expression, which extracts parts from the email as follows:


[widget_type]: [widget_title]

Alternatively it will just take the first word as the widget type. i.e.:


[widget_type]

In plain English, it means that you can add notes and lists via email. For example:


To: 7b73dc22bd7fd@localhost
Subject: List: Great List

* Do This
* Do That

--
Woo!

Adds a list called “Great List” to the page with two list items, “Do This” and “Do That”.


To: 7b73dc22bd7fd@localhost
Subject: note: Some note

I really need to note this down!

Adds a note called “Some note” to the page.