Class: Hanami::Mailer::Delivery::SMTP
- Inherits:
-
Object
- Object
- Hanami::Mailer::Delivery::SMTP
- Defined in:
- lib/hanami/mailer/delivery/smtp.rb
Overview
SMTP delivery method
Instance Method Summary collapse
-
#call(message) ⇒ Object
private
Deliver a message via SMTP.
-
#initialize(**options) ⇒ SMTP
constructor
private
Initialize SMTP delivery with configuration.
Constructor Details
#initialize(**options) ⇒ SMTP
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize SMTP delivery with configuration
17 18 19 |
# File 'lib/hanami/mailer/delivery/smtp.rb', line 17 def initialize(**) @options = end |
Instance Method Details
#call(message) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Deliver a message via SMTP
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/hanami/mailer/delivery/smtp.rb', line 26 def call() mail = to_mail() mail.delivery_method(:smtp, @options) delivery_exception = nil begin mail.deliver! rescue Net::SMTPError => exception delivery_exception = exception end Result.new( message: , response: mail, success: delivery_exception.nil?, error: delivery_exception ) end |