2022-06-07 10:58:04 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Patch from
|
|
|
|
# https://github.com/rails/rails/issues/44698#issuecomment-1069675285 to enable
|
|
|
|
# previous behavior with Net::SMTP regarding TLS.
|
|
|
|
#
|
|
|
|
# This should be fixed in an upcoming release of the Mail gem (probably 2.8),
|
|
|
|
# when this patch is merged: https://github.com/mikel/mail/pull/1435
|
2022-06-08 08:53:37 -04:00
|
|
|
module FreedomPatches
|
|
|
|
module MailDisableStarttls
|
|
|
|
def build_smtp_session
|
|
|
|
super.tap do |smtp|
|
|
|
|
unless settings[:enable_starttls_auto]
|
|
|
|
smtp.disable_starttls if smtp.respond_to?(:disable_starttls)
|
2022-06-07 10:58:04 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-06-08 08:53:37 -04:00
|
|
|
::Mail::SMTP.prepend(self)
|
|
|
|
end
|
2022-06-07 10:58:04 -04:00
|
|
|
end
|