Module: Studio::Email

Defined in:
lib/studio/email.rb

Class Method Summary collapse

Class Method Details

.deliver(mailer, action, *args, to:, user: nil, **kwargs) ⇒ Object

Shared email send entry point for Studio apps.

Apps with an existing top-level EmailDelivery model keep using it through this facade. Apps that have installed the engine outbox migration use the namespaced Studio::EmailDelivery model. Apps without either still send via ActionMailer’s normal deliver_later path.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/studio/email.rb', line 12

def deliver(mailer, action, *args, to:, user: nil, **kwargs)
  if (adapter = app_delivery_adapter)
    return adapter.deliver(mailer, action, *args, to: to, user: user, **kwargs)
  end

  if (adapter = studio_delivery_adapter)
    return adapter.deliver(mailer, action, *args, to: to, user: user, **kwargs)
  end

  mailer.public_send(action, *args, **kwargs).deliver_later
end