From cf1b0a4c16d7be9ac4f95355f2e5aa7c7bafb74e Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 7 Oct 2024 10:36:07 +0300 Subject: [PATCH] add noverify smtp option --- app/views/email_smtp_settings/index.html.erb | 2 +- lib/action_mailer_configs_interceptor.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/email_smtp_settings/index.html.erb b/app/views/email_smtp_settings/index.html.erb index 9a3aa2a8..5616f216 100644 --- a/app/views/email_smtp_settings/index.html.erb +++ b/app/views/email_smtp_settings/index.html.erb @@ -38,7 +38,7 @@
<%= ff.label :security_label, 'SMTP Security', class: 'label' %>
- <% [%w[Auto none], %w[SSL ssl], %w[TLS tls]].each do |(label, val)| %> + <% [%w[Auto none], %w[SSL ssl], %w[TLS tls], %w[Noverify noverify]].each do |(label, val)| %> <%= ff.label :security, value: val, for: "#{val}_radio", class: 'label' do %> <%= ff.radio_button :security, val, checked: (value['security'].blank? && val == 'none') || value['security'] == val, id: "#{val}_radio", class: 'base-radio mr-2' %> <%= label %> diff --git a/lib/action_mailer_configs_interceptor.rb b/lib/action_mailer_configs_interceptor.rb index ac5d01b5..b868fc27 100644 --- a/lib/action_mailer_configs_interceptor.rb +++ b/lib/action_mailer_configs_interceptor.rb @@ -43,9 +43,9 @@ module ActionMailerConfigsInterceptor address: value['host'], port: value['port'], domain: value['domain'], - openssl_verify_mode: OpenSSL::SSL::VERIFY_NONE, + openssl_verify_mode: value['security'] == 'noverify' ? OpenSSL::SSL::VERIFY_NONE : nil, authentication: value['password'].present? ? value.fetch('authentication', 'plain') : nil, - enable_starttls_auto: true, + enable_starttls_auto: value['security'] != 'tls', open_timeout: OPEN_TIMEOUT, read_timeout: READ_TIMEOUT, ssl: value['security'] == 'ssl',