As part of the Ruby Summer of Code, Jonathan Rudenberg has released Mailman. Mailman aims to provide the classy Sinatra declarative style for handling incoming mail:

Mailman is a Ruby gem so it’s easy to install:

sudo gem install mailman

Then you’re ready to start handling some mail:

require 'mailman'

Mailman.config.maildir = '~/Maildir'

Mailman::Application.run do
  to 'ticket-%id%@vipsupport.com' do

    Ticket.find(params[:id]).add_reply(message)
  end

  from('%user%@example.org').subject(/RE: (.*)/) do
    params[:user] #=> 'chunkybacon'
    # it is an indifferent hash, so you can use strings and symbols
    # interchangeably as keys
    params['captures'][0] #=> 'A very important message about pigs'
  end
end

Simple and classy.

The comments on Jonathan’s original blog post suggested he change the name to something more Googleable. Jonathan, if you’re open to suggestions, might we suggest KarlMalone?

[Source on GitHub]


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.