class GovukNotifyRails::Mailer

Attributes

govuk_notify_email_reply_to[RW]
govuk_notify_personalisation[RW]
govuk_notify_reference[RW]
govuk_notify_template[RW]

Protected Instance Methods

_default_body() click to toggle source
# File lib/govuk_notify_rails/mailer.rb, line 40
def _default_body
  'This is a GOV.UK Notify email with template %s and personalisation: %s' % [govuk_notify_template, govuk_notify_personalisation]
end
mail(headers = {}) click to toggle source
Calls superclass method
# File lib/govuk_notify_rails/mailer.rb, line 12
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
  message.govuk_notify_email_reply_to = govuk_notify_email_reply_to
end
set_email_reply_to(address) click to toggle source
# File lib/govuk_notify_rails/mailer.rb, line 36
def set_email_reply_to(address)
  self.govuk_notify_email_reply_to = address
end
set_personalisation(personalisation) click to toggle source
# File lib/govuk_notify_rails/mailer.rb, line 32
def set_personalisation(personalisation)
  self.govuk_notify_personalisation = personalisation
end
set_reference(reference) click to toggle source
# File lib/govuk_notify_rails/mailer.rb, line 28
def set_reference(reference)
  self.govuk_notify_reference = reference
end
set_template(template) click to toggle source
# File lib/govuk_notify_rails/mailer.rb, line 24
def set_template(template)
  self.govuk_notify_template = template
end