Class: MailHandler::SES::Mailer

Inherits:
Object
  • Object
show all
Defined in:
lib/interfaces/ses.rb

Overview

Yields an interface to SES

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Mailer

Returns a new instance of Mailer.



17
18
19
20
21
22
23
24
# File 'lib/interfaces/ses.rb', line 17

def initialize(config)
  @ses = ::AWS::SES::Base.new(
    access_key_id:     config[:access_key_id],
    secret_access_key: config[:secret_access_key],
    server:            config[:ses_server]
  )
  check_connection
end

Instance Method Details

#send_mail(email) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/interfaces/ses.rb', line 26

def send_mail(email)
  response = @ses.send_email email.to_h
  log email, response
  response
rescue StandardError => e
  puts e.to_s
end