## Fix for smtp breaking on an array of destination addresses
## The exception notifier, specifically, was failing to deliver emails
## because this problem.

## Code is from Dmitry Polushkin
## https://rails.lighthouseapp.com/projects/8994/tickets/2340-action-mailer-cant-deliver-mail-via-smtp-on-ruby-191

module ActionMailer
  class Base
    def perform_delivery_smtp(mail)
      destinations = mail.destinations
      mail.ready_to_send
      sender = (mail['return-path'] && mail['return-path'].spec) || Array(mail.from).first

      smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
      smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto)
      smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password],
                 smtp_settings[:authentication]) do |smtp|
        smtp.sendmail(mail.encoded, sender, destinations)
      end
    end
  end
end

Fix for ExceptionNotifier failing to send emails
Fix for ExceptionNotifier failing to send emails

Fix for smtp breaking on an array of destination
addresses.

The exception notifier, specifically, was
failing to deliver emails because of this problem.

The fix is from Dmitry Polushkin
https://rails.lighthouseapp.com/projects/8994/tickets/2340-action-mailer-cant-deliver-mail-via-smtp-on-ruby-191
