markbates / mack-more
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
1126ab0
commit 1126ab04bfc28a3f615188da1740e95a36fb19bd
tree 9ba64f29f1439d320e920605c12fd46c690ff37b
parent db86e48f0d187b5ad3b3f5547f91e5e2eabd97c6
tree 9ba64f29f1439d320e920605c12fd46c690ff37b
parent db86e48f0d187b5ad3b3f5547f91e5e2eabd97c6
mack-more / mack-notifier
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

