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 '[email protected]' from '[email protected]' subject 'Welcome to the site!' locals :name => name render 'registration' end end
Use the mailer to deliver messages:
deliver(:sample, :registration, "Bob", "21")
#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. #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 a Mailer
base object with specified options. Constructs a Mailer
base object with specified options.
Returns the value of attribute app
Returns the value of attribute delivery_settings
Returns the value of attribute mailer_name
Returns the value of attribute messages
Defines the default attributes for a message in this mailer (including app-wide defaults).
Defines a mailer object allowing the definition of various email messages that can be delivered.
© 2010–2019 Padrino
Licensed under the MIT License.
https://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Mailer/Base