Class: Mailer
- Inherits:
-
Object
- Object
- Mailer
- Defined in:
- lib/feedle.rb
Overview
Mailer class
Instance Method Summary collapse
-
#initialize(config) ⇒ Mailer
constructor
A new instance of Mailer.
- #send(file) ⇒ Object
Constructor Details
#initialize(config) ⇒ Mailer
Returns a new instance of Mailer.
18 19 20 |
# File 'lib/feedle.rb', line 18 def initialize(config) @config = config['mailer'] || {} end |
Instance Method Details
#send(file) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/feedle.rb', line 22 def send(file) mail = Mail.new mail.from = @config['from_address'] mail.to = @config['to_address'] mail.subject = 'Kindle delivery' mail.add_file file if @config['delivery_method'] mail.delivery_method @config['delivery_method'], @config['options'].inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} end mail.deliver! end |