diff --git a/app/jobs/inboxes/fetch_imap_emails_job.rb b/app/jobs/inboxes/fetch_imap_emails_job.rb index 2b77d068c..6a30562e8 100644 --- a/app/jobs/inboxes/fetch_imap_emails_job.rb +++ b/app/jobs/inboxes/fetch_imap_emails_job.rb @@ -9,8 +9,10 @@ class Inboxes::FetchImapEmailsJob < ApplicationJob fetch_mail_for_channel(channel) # clearing old failures like timeouts since the mail is now successfully processed channel.reauthorized! - rescue Errno::ECONNREFUSED, Net::OpenTimeout, Net::IMAP::NoResponseError + rescue Errno::ECONNREFUSED, Net::OpenTimeout, Net::IMAP::NoResponseError, Errno::ECONNRESET, Errno::ENETUNREACH, Net::IMAP::ByeResponseError channel.authorization_error! + rescue EOFError => e + Rails.logger.error e rescue StandardError => e ChatwootExceptionTracker.new(e, account: channel.account).capture_exception end diff --git a/app/mailboxes/mailbox_helper.rb b/app/mailboxes/mailbox_helper.rb index 6aaf4fde3..f0abc0eba 100644 --- a/app/mailboxes/mailbox_helper.rb +++ b/app/mailboxes/mailbox_helper.rb @@ -35,7 +35,7 @@ module MailboxHelper def create_contact @contact_inbox = ::ContactBuilder.new( - source_id: "email:#{processed_mail.message_id}", + source_id: processed_mail.original_sender, inbox: @inbox, contact_attributes: { name: identify_contact_name,