Padrino::Mailer::Base
Class: Padrino::Mailer::Base
- Inherits:
- Object
- Object
- Padrino::Mailer::Base
Overview
This is the abstract class that other mailers will inherit from in order to send mail.
You can set the default delivery settings from your app through:
set :delivery_method, :smtp => { :address => 'smtp.yourserver.com', :port => '25', :user_name => 'user', :password => 'pass', :authentication => :plain }
or sendmail:
set :delivery_method, :sendmail
or for tests:
set :delivery_method, :test
and all delivered mail will use these settings unless otherwise specified.
Define a mailer in your application:
# app/mailers/sample_mailer.rb MyAppName.mailers :sample do defaults :content_type => 'html' email :registration do |name, age| to 'user@domain.com' from 'admin@site.com' subject 'Welcome to the site!' locals :name => name render 'registration' end end
Use the mailer to deliver messages:
deliver(:sample, :registration, "Bob", "21")
Instance Attribute Summary
-
#app ⇒ Object
Returns the value of attribute app. -
#delivery_settings ⇒ Object
Returns the value of attribute delivery_settings. -
#mailer_name ⇒ Object
Returns the value of attribute mailer_name. -
#messages ⇒ Object
Returns the value of attribute messages.
Instance Method Summary
-
#defaults(attributes = nil) ⇒ Object
Defines the default attributes for a message in this mailer (including app-wide defaults). -
#email(name, &block) ⇒ Object (also: #message)
Defines a mailer object allowing the definition of various email messages that can be delivered. -
#initialize(app, name, &block) ⇒ Base
constructor Constructs aMailer
base object with specified options.
Constructor Details
#initialize(app, name, &block) ⇒ Base
Constructs a Mailer
base object with specified options.
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app
#delivery_settings ⇒ Object
Returns the value of attribute delivery_settings
#mailer_name ⇒ Object
Returns the value of attribute mailer_name
#messages ⇒ Object
Returns the value of attribute messages
Instance Method Details
#defaults(attributes = nil) ⇒ Object
Defines the default attributes for a message in this mailer (including app-wide defaults).
#email(name, &block) ⇒ Object Also known as: message
Defines a mailer object allowing the definition of various email messages that can be delivered.
© 2010–2016 Padrino
Licensed under the MIT License.
http://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Mailer/Base