aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer/delivery_job.rb
blob: f008671a721cac655f3596df5afd35d6f62d6fed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'active_job'

module ActionMailer
  # The <tt>ActionMailer::DeliveryJob</tt> class is used when you
  # want to send emails outside of the request-response cycle.
  class DeliveryJob < ActiveJob::Base # :nodoc:
    queue_as { ActionMailer::Base.deliver_later_queue_name }

    def perform(mailer, mail_method, delivery_method, locale, *args) #:nodoc:
      I18n.with_locale(locale) do
        mailer.constantize.public_send(mail_method, *args).send(delivery_method)
      end
    end
  end
end