mirror of
https://github.com/discourse/discourse.git
synced 2024-12-12 15:46:31 +08:00
fb184fed06
This should make it easier to track down how the incoming email was created, which is one of four locations: The POP3 poller (which picks up reply via email replies) The admin email controller #handle_mail (which is where hosted mail is sent) The IMAP sync tool The group SMTP mailer, which sends emails when replying to IMAP topics, pre-emptively creating IncomingEmail records to avoid double syncing
23 lines
473 B
Ruby
23 lines
473 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
|
|
class ProcessEmail < ::Jobs::Base
|
|
sidekiq_options retry: 3
|
|
|
|
def execute(args)
|
|
Email::Processor.process!(
|
|
args[:mail],
|
|
retry_on_rate_limit: args[:retry_on_rate_limit] || false,
|
|
source: args[:source]&.to_sym
|
|
)
|
|
end
|
|
|
|
sidekiq_retries_exhausted do |msg|
|
|
Rails.logger.warn("Incoming email could not be processed after 3 retries.\n\n#{msg["args"][:mail]}")
|
|
end
|
|
|
|
end
|
|
|
|
end
|