Rails3 ActionMailer delivery method for Mad Mimi
Pull request Compare This branch is 3 commits ahead of njackson:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.bundle
lib
spec
.document
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE
README.rdoc
Rakefile
VERSION
mad_mimi_mail.gemspec
mad_mimi_mailer.gemspec

README.rdoc

mad_mimi_mailer

If you're not using ActionMailer 3.0 or later, please use version 0.1.2.1 of mad_mimi_mailer.

Installation

Add to your Gemfile:

gem 'mad_mimi_mailer'

Then run

$ bundle install

Add to environment.rb, or somewhere before your app loads:

MadMimiMail::Configuration.api_settings = {:email => "<email>", :api_key => "<api key>"}

Usage

Create a new mailer as a subclass of MadMimiMailer :

class MyMailer < MadMimiMailer
  def money_making_email(user)
    mimi_params = {
      :promotion_name => "rakin' it in",
      :to => user.email,
      :subject => "sign up now!" }

    mail(mimi_params).do |format|
      format.html
      format.text
    end
  end
end

The following parameters are given to Mimi in addition to the rendered content:

:name, :from, :subject, :promotion_name, :list_name, :raw_yaml

madmimi.com/developer/mailer/methods

Use your mailer just like ActionMailer::Base, except your emails will be sent via MadMimi.

MyMiailer.money_making_email(user).deliver!

Use ActionMailer::Base and configure individual mailers:

class MyMailer < ActionMailer::Base
 self.delivery_method = :madmimi
 ...
end

Configure ActionMailer::Base to use Mimi by default:

This may be useful for switching your default mailer in test and/or development environments

MyApp::Application.config.action_mailer.delivery_method = :madmimi
## or ##
ActionMailer::Base.delivery_method = :madmimi

Copyright © 2010 Nate Jackson. See LICENSE for details.