Home
Ruby on Rails
Cheatsheets
To use ActionMailer, you need to create a mailer model. Emails are defined by creating methods within the mailer model which are then used to set variables to be used in the mail template, to change options on the mail, or to add attachments.
ruby script/generate mailer NameOfMailer method1 method2 method3
class OrderMailer < ActionMailer::Base def confirm(order,sent_at = Time.now) subject "Subject line goes here" body :order => order recipients ["bill@microsoft.com", "steve@apple.com"] from "david@dizzy.co.uk" sent_on sent_at end end