Class: Lipwig::Senders::SMTP

Inherits:
Abstract show all
Defined in:
lib/lipwig/senders/smtp.rb

Direct Known Subclasses

SMTPConnection

Instance Method Summary collapse

Methods inherited from Abstract

call, #initialize

Constructor Details

This class inherits a constructor from Lipwig::Senders::Abstract

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/lipwig/senders/smtp.rb', line 4

def call
  recipients.each do |recipient|
    mail = Mail.new
    mail.delivery_method delivery_method, delivery_method_options

    mail.content_type = 'text/html; charset=UTF-8'
    mail.from         = from
    mail.to           = recipient
    mail.subject      = email.subject
    mail.body         = email.body
    mail.cc           = email.ccs

    begin
      puts "Delivery To:     #{Array(recipient).join(', ')}"
      mail.deliver!
      puts "Delivery Status: OK", ""
    rescue => error
      puts "Delivery Status: Failed (#{error.message})", ""
    end
  end
end