class ActionMailer::MailDeliveryJob
:nodoc:
Exceptions are rescued and handled by the mailer class.
sending either parameterized or normal mail.
want to send emails outside of the request-response cycle. It supports
The ActionMailer::MailDeliveryJob
class is used when you
= Action Mailer MailDeliveryJob
def handle_exception_with_mailer_class(exception)
def handle_exception_with_mailer_class(exception) if klass = mailer_class klass.handle_exception exception else raise exception end end
def mailer_class
"Deserialize" the mailer class name by hand in case another argument
def mailer_class if mailer = Array(@serialized_arguments).first || Array(arguments).first mailer.constantize end end
def perform(mailer, mail_method, delivery_method, args:, kwargs: nil, params: nil)
def perform(mailer, mail_method, delivery_method, args:, kwargs: nil, params: nil) mailer_class = params ? mailer.constantize.with(params) : mailer.constantize message = if kwargs mailer_class.public_send(mail_method, *args, **kwargs) else mailer_class.public_send(mail_method, *args) end message.send(delivery_method) end