Class: Mailer
- Inherits:
-
Object
- Object
- Mailer
- Defined in:
- lib/mailer.rb
Class Method Summary collapse
Class Method Details
.credentials ⇒ Object
9 10 11 |
# File 'lib/mailer.rb', line 9 def self.credentials @credentials ||= {:from => '[email protected]', :subject => "Password reset", :body => "Someone hopefully you, requested password rest"} end |
.delivery_method ⇒ Object
5 6 7 |
# File 'lib/mailer.rb', line 5 def self.delivery_method @delivery_method ||= {:type => :sendmail, :options => {} } end |
.send_mail(args = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mailer.rb', line 13 def self.send_mail args = {} mail = Mail.new do from Mailer.credentials[:from] to args[:to] subject Mailer.credentials[:subject] text_part do body Mailer.credentials[:body]+'\n'+args[:link] end html_part do content_type 'text/html; charset=UTF-8' body Mailer.credentials[:body].gsub(/\n/, '<br />')+"<br /><a href='#{args[:link]}'>#{args[:link]}</a>" end end mail.delivery_method Mailer.delivery_method[:type], Mailer.delivery_method[:options] mail.deliver if ENV['RACK_ENV'] != "test" end |