chore: Stop processing auto-response emails (#9606)
Stop processing auto-response emails https://www.notion.so/chatwoot/Avoid-Auto-Replies-sorcerer-s-apprentice-mode-55ffb09efbd7451994f1ff852de4c168?pvs=4
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
class SupportMailbox < ApplicationMailbox
|
||||
include IncomingEmailValidityHelper
|
||||
attr_accessor :channel, :account, :inbox, :conversation, :processed_mail
|
||||
|
||||
before_processing :find_channel,
|
||||
@@ -9,16 +10,8 @@ class SupportMailbox < ApplicationMailbox
|
||||
def process
|
||||
Rails.logger.info "Processing email #{mail.message_id} from #{original_sender_email} to #{mail.to} with subject #{mail.subject}"
|
||||
|
||||
# to turn off spam conversation creation
|
||||
return unless @account.active?
|
||||
# prevent loop from chatwoot notification emails
|
||||
return if notification_email_from_chatwoot?
|
||||
|
||||
# return if email doesn't have a valid sender
|
||||
# This can happen in cases like bounce emails for invalid contact email address
|
||||
# TODO: Handle the bounce seperately and mark the contact as invalid
|
||||
# we are checking for @ since the returned value could be "\"\"" for some email clients
|
||||
return unless original_sender_email.include?('@')
|
||||
# Skip processing email if it belongs to any of the edge cases
|
||||
return unless incoming_email_from_valid_email?
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
find_or_create_contact
|
||||
|
||||
Reference in New Issue
Block a user