Sha256: f507446a5ef0a26641f4e038874d4ce4e69e5f671588423740c256f248e34783
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
module GovukNotifyRails class Mailer < ActionMailer::Base default delivery_method: :govuk_notify attr_accessor :govuk_notify_template attr_accessor :govuk_notify_reference attr_accessor :govuk_notify_personalisation protected def mail(headers = {}) raise ArgumentError, 'Missing template ID. Make sure to use `set_template` before calling `mail`' if govuk_notify_template.nil? headers[:body] ||= _default_body message = super(headers) message.govuk_notify_template = govuk_notify_template message.govuk_notify_reference = govuk_notify_reference message.govuk_notify_personalisation = govuk_notify_personalisation end def set_template(template) self.govuk_notify_template = template end def set_reference(reference) self.govuk_notify_reference = reference end def set_personalisation(personalisation) self.govuk_notify_personalisation = personalisation end def _default_body 'This is a GOV.UK Notify email with template %s and personalisation: %s' % [govuk_notify_template, govuk_notify_personalisation] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
govuk_notify_rails-2.1.0 | lib/govuk_notify_rails/mailer.rb |
govuk_notify_rails-2.0.0 | lib/govuk_notify_rails/mailer.rb |