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:
Sojan Jose
2024-06-13 14:19:11 -07:00
committed by GitHub
parent 08516e6c43
commit 7968e98529
9 changed files with 1344 additions and 34 deletions

View File

@@ -146,8 +146,25 @@ class MailPresenter < SimpleDelegator
end
end
def auto_reply?
auto_submitted? || x_auto_reply?
end
def notification_email_from_chatwoot?
# notification emails are send via mailer sender email address. so it should match
original_sender == Mail::Address.new(ENV.fetch('MAILER_SENDER_EMAIL', 'Chatwoot <accounts@chatwoot.com>')).address
end
private
def auto_submitted?
@mail['Auto-Submitted'].present? && @mail['Auto-Submitted'].value != 'no'
end
def x_auto_reply?
@mail['X-Autoreply'].present? && @mail['X-Autoreply'].value == 'yes'
end
# forcing the encoding of the content to UTF-8 so as to be compatible with database and serializers
def encode_to_unicode(str)
return '' if str.blank?