Module: Pony
- Defined in:
- lib/pony.rb
Constant Summary collapse
- @@options =
{}
Class Method Summary collapse
-
.mail(options) ⇒ Object
Send an email Pony.mail(:to => ‘[email protected]’, :from => ‘[email protected]’, :subject => ‘hi’, :body => ‘Hello there.’) Pony.mail(:to => ‘[email protected]’, :html_body => ‘<h1>Hello there!</h1>’, :body => “In case you can’t read html, Hello there.”) Pony.mail(:to => ‘[email protected]’, :cc => ‘[email protected]’, :from => ‘[email protected]’, :subject => ‘hi’, :body => ‘Howsit!’).
- .options ⇒ Object
-
.options=(value) ⇒ Object
Default options can be set so that they don’t have to be repeated.
Class Method Details
.mail(options) ⇒ Object
Send an email
Pony.mail(:to => '[email protected]', :from => '[email protected]', :subject => 'hi', :body => 'Hello there.')
Pony.mail(:to => '[email protected]', :html_body => '<h1>Hello there!</h1>', :body => "In case you can't read html, Hello there.")
Pony.mail(:to => '[email protected]', :cc => '[email protected]', :from => '[email protected]', :subject => 'hi', :body => 'Howsit!')
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/pony.rb', line 124 def self.mail() = @@options.merge raise(ArgumentError, ":to is required") unless [:to] [:via] = default_delivery_method unless .has_key?(:via) = cross_reference_depricated_fields() if .has_key?(:via) && [:via] == :sendmail [:via_options] ||= {} [:via_options][:location] ||= sendmail_binary end deliver build_mail() end |
.options ⇒ Object
116 117 118 |
# File 'lib/pony.rb', line 116 def self.() @@options end |
.options=(value) ⇒ Object
Default options can be set so that they don’t have to be repeated.
Pony. = { :from => '[email protected]', :via => :smtp, :via_options => { :host => 'smtp.yourserver.com' } }
Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from [email protected] using smtp
Pony.mail(:from => '[email protected]', :to => 'foo@bar') # Sends mail to foo@bar from [email protected] using smtp
112 113 114 |
# File 'lib/pony.rb', line 112 def self.(value) @@options = value end |