markbates / mack-more

All the extra stuff you could want for the Mack Framework.

This URL has Read+Write access

dsutedja (author)
Tue Aug 12 11:22:41 -0700 2008
commit  0178c47330da90af4140cb2784227ff423664ce1
tree    6098933196a7f7d27f45fab80eed9980fa70a929
parent  0610674e5a4537030cd1a1230f37b038af4c2189
mack-more / mack-notifier
name age message
..
file README Loading commit data...
file Rakefile
directory lib/
directory spec/
mack-notifier/README
This gem provides a simple API for creating emails within a Mack application.

A simple Mack::Notifier model would look like this:

  class WelcomeEmail
    include Mack::Notifier
  end
  
To use this in your application you would do something like the following:
 
  mail = WelcomeEmail.new
  mail.to = "foo@example.com"
  mail.from = "me@example.com"
  mail.subject = "Hello"
  mail.body(:plain, "This is my plain text body")
  mail.body(:html, "This is my <b>HTML</b> body")
  mail.attach(Mack::Notifier::Attachment.new("/path/to/my/image_file.png"))
  mail.attach(Mack::Notifier::Attachment.new("/path/to/my/pdf_file.pdf"))
  mail.deliver
  
This gem currently has an adapter for TMail, but it can support any mailing
framework under the covers with the creation of a simple adapter class.

Currently implemented delivery handlers are: SMTP (default), sendmail, and test.

== Testing

When testing you can get access to delivered emails with the delivered_emails
method. After each tests these emails will be flushed our of the test handler.

== Rake tasks
  
  # Generates a notifier model, a test, and text and html template files.
  rake generate:notifier