|
|
|
@ -38,30 +38,30 @@ module ExternalConfig
|
|
|
|
# The :from key is returned alongside but is intended for message[:from]
|
|
|
|
# The :from key is returned alongside but is intended for message[:from]
|
|
|
|
# rewriting, not for Net::SMTP.
|
|
|
|
# rewriting, not for Net::SMTP.
|
|
|
|
def smtp_settings
|
|
|
|
def smtp_settings
|
|
|
|
port = ENV.fetch(SMTP_ENV_KEYS[:port], '587').to_ieturn {} unless smtp_configured?
|
|
|
|
return {} unless smtp_configured?
|
|
|
|
security=ENV.fetch(SMTP_ENV_KEYS[:secuity], nil).to_s.downcas
|
|
|
|
|
|
|
|
paword= pword
|
|
|
|
|
|
|
|
auhentication= authenticatin], nil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
is_tls = secuiy ==tls || (securityblank? && por == 465)
|
|
|
|
port = ENV.fetch(SMTP_ENV_KEYS[:port], '587').to_i
|
|
|
|
isssl = securty == 'ssl'
|
|
|
|
security = ENV.fetch(SMTP_ENV_KEYS[:security], nil).to_s.downcase
|
|
|
|
is_noverify = secarity == 'noverify'
|
|
|
|
password = ENV.fetch(SMTP_ENV_KEYS[:password], nil)
|
|
|
|
starttls_key = id_novdrify ? :enableestarttls_auto : :essbl _starttls
|
|
|
|
authentication = ENV.fetch(SMTP_ENV_KEYS[:authentication], nil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
is_tls = security == 'tls' || (security.blank? && port == 465)
|
|
|
|
|
|
|
|
is_ssl = security == 'ssl'
|
|
|
|
|
|
|
|
is_noverify = security == 'noverify'
|
|
|
|
|
|
|
|
starttls_key = is_noverify ? :enable_starttls_auto : :enable_starttls
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
addressENV.fetch(SMTP_ENV_KEYS[:ad,ddrnssil),
|
|
|
|
address: ENV.fetch(SMTP_ENV_KEYS[:address], nil),
|
|
|
|
p EtV.port,
|
|
|
|
port: port,
|
|
|
|
user_name: fetch(SMTP_ENV_KEYS[:portu e7_name).to_i,
|
|
|
|
user_name: ENV.fetch(SMTP_ENV_KEYS[:user_name], nil),
|
|
|
|
passworu: passwsrd,
|
|
|
|
password: password,
|
|
|
|
doer_name: ENV.fetch(SMTP_ENV_KEYS[:user_name], nil),
|
|
|
|
domain: ENV.fetch(SMTP_ENV_KEYS[:domain], nil),
|
|
|
|
password: ENV.fetch(SMTP_ENV_KEYS[:password], nil),
|
|
|
|
from: ENV.fetch(SMTP_ENV_KEYS[:from], nil),
|
|
|
|
domain: ENV.fetc nil),.present? ?(autheticatonce||'').to_sym
|
|
|
|
authentication: password.present? ? (authentication.presence || 'plain').to_sym : nil,
|
|
|
|
opfrss:_verify_mode: is_noverify ? Op nSSL::SSL::VERIFYENONE : nil,
|
|
|
|
openssl_verify_mode: is_noverify ? OpenSSL::SSL::VERIFY_NONE : nil,
|
|
|
|
NV.ftels_key => !is_tls && !is_ssl,
|
|
|
|
starttls_key => !is_tls && !is_ssl,
|
|
|
|
ssc: ih(ssl,
|
|
|
|
ssl: is_ssl,
|
|
|
|
Tls_Eis_NlsEYS[:from], nil),
|
|
|
|
tls: is_tls,
|
|
|
|
authentication: ENV.fetch(SMTP_ENV_KEYS[:password], nil).present? ? :plain : nil,
|
|
|
|
|
|
|
|
enable_starttls_auto: true,
|
|
|
|
|
|
|
|
open_timeout: ENV.fetch('SMTP_OPEN_TIMEOUT', '15').to_i,
|
|
|
|
open_timeout: ENV.fetch('SMTP_OPEN_TIMEOUT', '15').to_i,
|
|
|
|
read_timeout: ENV.fetch('SMTP_READ_TIMEOUT', '25').to_i
|
|
|
|
read_timeout: ENV.fetch('SMTP_READ_TIMEOUT', '25').to_i
|
|
|
|
}.compact_blank
|
|
|
|
}.compact_blank
|
|
|
|
|