fix: Remove IMAP and SMTP email validation (#4435)

* Remove IMAP and SMTP email validation
* Rename imap_email & smtp_email columns to imap_login & smtp_login respectively.
* Use channel email domain if inbound email domain not present
This commit is contained in:
Aswin Dev P.S
2022-04-11 19:37:20 +05:30
committed by GitHub
parent 3d164271a8
commit 31cdc63e18
17 changed files with 86 additions and 53 deletions

View File

@@ -128,11 +128,11 @@ class ConversationReplyMailer < ApplicationMailer
def custom_message_id
last_message = @message || @messages&.last
"<conversation/#{@conversation.uuid}/messages/#{last_message&.id}@#{@account.inbound_email_domain}>"
"<conversation/#{@conversation.uuid}/messages/#{last_message&.id}@#{channel_email_domain}>"
end
def in_reply_to_email
conversation_reply_email_id || "<account/#{@account.id}/conversation/#{@conversation.uuid}@#{@account.inbound_email_domain}>"
conversation_reply_email_id || "<account/#{@account.id}/conversation/#{@conversation.uuid}@#{channel_email_domain}>"
end
def conversation_reply_email_id

View File

@@ -26,7 +26,7 @@ module ConversationReplyMailerHelper
smtp_settings = {
address: @channel.smtp_address,
port: @channel.smtp_port,
user_name: @channel.smtp_email,
user_name: @channel.smtp_login,
password: @channel.smtp_password,
domain: @channel.smtp_domain,
tls: @channel.smtp_enable_ssl_tls,
@@ -48,10 +48,18 @@ module ConversationReplyMailerHelper
end
def email_from
email_smtp_enabled ? @channel.smtp_email : from_email_with_name
email_smtp_enabled ? @channel.email : from_email_with_name
end
def email_reply_to
email_imap_enabled ? @channel.imap_email : reply_email
email_imap_enabled ? @channel.email : reply_email
end
# Use channel email domain in case of account email domain is not set for custom message_id and in_reply_to
def channel_email_domain
return @account.inbound_email_domain if @account.inbound_email_domain.present?
email = @inbox.channel.try(:email)
email.present? ? email.split('@').last : raise(StandardError, 'Channel email domain not present.')
end
end