Sha256: e827f17b8f103ffe7c7d47fb6f9a0a3409aae85dbc8824bffe0ba921380e4615
Contents?: true
Size: 956 Bytes
Versions: 2
Compression:
Stored size: 956 Bytes
Contents
module GovukNotifyRails class Mailer < ActionMailer::Base default delivery_method: :govuk_notify attr_accessor :govuk_notify_template 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_personalisation = govuk_notify_personalisation end def set_template(template) self.govuk_notify_template = template 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-1.0.0 | lib/govuk_notify_rails/mailer.rb |
govuk_notify_rails-0.0.2 | lib/govuk_notify_rails/mailer.rb |