Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Little library for composing JSON from Postmark's incoming email api back into an object
Branch: master
Failed to load latest commit information.
lib Fixed a bug with a non-rewound tempfile
spec Fixed a bug with a non-rewound tempfile
.gitignore First pass at a prototype mitt for Postmark
LICENSE First pass at a prototype mitt for Postmark
README.rdoc Updated readme to include version numbers
Rakefile Tweak rakefile for generating gemspec
VERSION Version bump to 0.0.11
postmark-mitt.gemspec Regenerate gemspec for version 0.0.10


Postmark Mitt

This gem provides a little wrapper object for taking JSON from Postmark's incoming email system and composing it back into an object resembling an email. This comes in handy when you are trying to figure out what to do with the email.

Postmark-mitt has been verified to work on Ruby Enterprise Edition 1.8.7, 1.9.2 and 1.9.3.


gem install postmark-mitt


require 'lib/postmark_mitt'

# if you are just playing with this library
email ="path/to/json/file/in/spec/fixtures"))

# if you are doing this in a controller
email = # ""
email.from # Bob Bobson <>
email.from_email #
email.headers # returns a hash of the headers

email.attachments # array of attachment objects

attachment = email.attachments.first
attachment.content_type # will base64 decode the content... eventually this will lazy-load the file from Postmark
attachment.size # NYI
# You get the idea

A lot of times you want to do something with the email, like create a post

mitt =

class Post
  def self.create_from_postmark(mitt)
    author = User.find_by_api_email(
    handle_no_author # send an email back saying we couldn't find them
    post = new
    post.title = mitt.subject = author =
    post.message_id = mitt.message_id # Make sure we don't process the same email twice
    # You get the idea, right?

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history.

  • Send me a pull request. Bonus points for topic branches.

Authors & Contributors

  • Randy Schmidt


Copyright © 2011 Randy Schmidt. See LICENSE for details.

Something went wrong with that request. Please try again.