feat: Support additional authentication mechanisms for SMTP (#4431)

* Support additional authentication mechanisms for SMTP
This commit is contained in:
Aswin Dev P.S
2022-04-11 15:43:05 +05:30
committed by GitHub
parent 8622740161
commit 9b5eb98c59
6 changed files with 60 additions and 3 deletions

View File

@@ -29,8 +29,12 @@ module Api::V1::InboxesHelper
smtp = Net::SMTP.new(channel_data[:smtp_address], channel_data[:smtp_port])
set_smtp_encryption(channel_data, smtp)
check_smtp_connection(channel_data, smtp)
end
smtp.start(channel_data[:smtp_domain], channel_data[:smtp_email], channel_data[:smtp_password], :login)
def check_smtp_connection(channel_data, smtp)
smtp.start(channel_data[:smtp_domain], channel_data[:smtp_email], channel_data[:smtp_password],
channel_data[:smtp_authentication]&.to_sym || :login)
smtp.finish unless smtp&.nil?
end