module Sinatra::Mailer

You“ll need a simple config like this in your configure block if you want to actually send mail:

Sinatra::Mailer.config = {
  :host   => "smtp.yourserver.com",
  :port   => "25",              
  :user   => "user",
  :pass   => "pass",
  :auth   => :plain # :plain, :login, :cram_md5, the default is no auth
  :domain => "localhost.localdomain" # the HELO domain provided by the client to the server 
}

or 

Sinatra::Mailer.config = {:sendmail_path => "/somewhere/odd"}
Sinatra::Mailer.delivery_method = :sendmail

From your event handlers then, you can just call the “email” method to deliver an email:

email :to => "foo@bar.com",
      :from => "bar@foo.com",
      :subject => "Welcome to whatever!",
      :body => haml(:sometemplate)

Attributes

config[RW]
delivery_method[RW]

Public Instance Methods

email(mail_options={}) click to toggle source
# File lib/sinatra_mailer/mailer.rb, line 41
def email(mail_options={})
  Email.new(mail_options).deliver!
end