Class: MultiSMTP::Mail
- Inherits:
-
Mail::SMTP
- Object
- Mail::SMTP
- MultiSMTP::Mail
- Defined in:
- lib/multi_smtp/mail.rb
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(default_settings) ⇒ Mail
constructor
A new instance of Mail.
Constructor Details
#initialize(default_settings) ⇒ Mail
Returns a new instance of Mail.
5 6 7 8 |
# File 'lib/multi_smtp/mail.rb', line 5 def initialize(default_settings) @default_settings = default_settings || {} super(@default_settings) end |
Instance Method Details
#deliver!(mail) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/multi_smtp/mail.rb', line 10 def deliver!(mail) providers = ordered_providers providers.each_with_index do |smtp_provider, index| self.settings = default_settings.merge(smtp_provider) begin super(mail) break rescue Exception => e next unless all_providers_failed?(index, providers) if error_notifier # Pass the exception and the mail to the notifier error_notifier.notify(e, mail) else raise e end end end end |