Class: Nuntius::RetrieveMailJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/nuntius/retrieve_mail_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/jobs/nuntius/retrieve_mail_job.rb', line 6

def perform
  klasses = Nuntius::BaseMessageBox.message_box_for(transport: :mail)

  klasses.each do |klass|
    RetrieveInboundMailService.perform(settings: klass.settings)
  end

  Nuntius::InboundMessage.where(status: "pending").each do |message|
    Nuntius::DeliverInboundMessageJob.perform_later(message)
  end
end