Module: Pony
- Defined in:
- lib/pony.rb
Constant Summary collapse
- @@options =
{}
- @@override_options =
{}
- @@subject_prefix =
false
- @@append_inputs =
false
Class Method Summary collapse
- .append_inputs ⇒ Object
-
.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.
- .override_options ⇒ Object
- .override_options=(value) ⇒ Object
- .permissable_options ⇒ Object
- .subject_prefix(value) ⇒ Object
Class Method Details
.append_inputs ⇒ Object
137 138 139 |
# File 'lib/pony.rb', line 137 def self.append_inputs @@append_inputs = true end |
.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!')
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/pony.rb', line 145 def self.mail() if @@append_inputs [:body] = "#{[:body]}/n #{.to_s}" end = @@options.merge = .merge @@override_options if @@subject_prefix [:subject] = "#{@@subject_prefix}#{[:subject]}" end fail ArgumentError, ':to is required' unless [:to] [:via] = default_delivery_method unless .key?(:via) if .key?(:via) && [:via] == :sendmail [:via_options] ||= {} [:via_options][:location] ||= sendmail_binary end deliver build_mail() end |
.options ⇒ Object
121 122 123 |
# File 'lib/pony.rb', line 121 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
117 118 119 |
# File 'lib/pony.rb', line 117 def self.(value) @@options = value end |
.override_options ⇒ Object
129 130 131 |
# File 'lib/pony.rb', line 129 def self. @@override_options end |
.override_options=(value) ⇒ Object
125 126 127 |
# File 'lib/pony.rb', line 125 def self.(value) @@override_options = value end |
.permissable_options ⇒ Object
169 170 171 |
# File 'lib/pony.rb', line 169 def self. + end |
.subject_prefix(value) ⇒ Object
133 134 135 |
# File 'lib/pony.rb', line 133 def self.subject_prefix(value) @@subject_prefix = value end |