Class: Martilla::Ses
- Inherits:
-
EmailNotifier
- Object
- Component
- Notifier
- EmailNotifier
- Martilla::Ses
- Defined in:
- lib/martilla/notifiers/ses.rb
Instance Attribute Summary
Attributes inherited from Notifier
Instance Method Summary collapse
Methods inherited from Notifier
create, #initialize, #invalid_options_msg, #send_failure?, #send_success?
Methods inherited from Component
Constructor Details
This class inherits a constructor from Martilla::Notifier
Instance Method Details
#error(msg, data) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/martilla/notifiers/ses.rb', line 34 def error(msg, data) begin ses_client.send_email( destination: { to_addresses: to_email.split(',') }, message: { body: { html: { charset: 'UTF-8', data: error_html(msg, data) }, text: { charset: 'UTF-8', data: error_txt(msg, data) } }, subject: { charset: 'UTF-8', data: failure_subject } }, source: from_email ) rescue Aws::SES::Errors::ServiceError => error puts "Email not sent. Error message: #{error}" end end |
#success(data) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/martilla/notifiers/ses.rb', line 5 def success(data) begin ses_client.send_email( destination: { to_addresses: to_email.split(',') }, message: { body: { html: { charset: 'UTF-8', data: success_html(data) }, text: { charset: 'UTF-8', data: success_txt(data) } }, subject: { charset: 'UTF-8', data: success_subject } }, source: from_email ) rescue Aws::SES::Errors::ServiceError => error puts "Email not sent. Error message: #{error}" end end |