Mailspy

ESP agnostic sending and tracking platform for email campaigns

Requirements

Mongodb > 1.8

Setup

Add gem “mailspy” to your Gemfile

gem "mailspy"

If you haven’t already create a mongoid.yml file for the mongodb connection

rails generate mongoid:config

Create the mongoid configuration for the mongo db

rails g mail_spy:initializer

Fill out the generated mailspy.rb with your esp settings (file has example)

Then mount the engine in the routes.rb file

Rails.application.routes.draw do
  mount MailSpy::Engine => "/mail_spy"
end

Usage

Mailspy is centered around email templates and instances of those templates (aka emails).

To create a template:

MailSpy.create_template(template_name, html_erb, text_erb, template_values_definition)

* Template name must be unique to all templates
* html, and text are the contents for a multipart email
* template_values_definition is a array of keys that should be present in the
  template values of each hash

To create a instance:

MailSpy.create_email(options)

required options include:

* :template_name
* :campaign :top level grouping
* :stream : mid level grouping
* :component : bottom level grouping
* :schedule_at
* :subject
* :template_values
* :from
* :reply_to
* one of [:to, :cc, :bcc]

Testing

You will need to add your own mongoid.yml to the dummy app, rake db:create, and rake db:migrate and rake db:test:prepare to get the dummy app setup.

Then you can simply run rake from the plugins test directory

TODO explain the test_email_credentials.yml file in /test

License

This project rocks and uses MIT-LICENSE.