class ApplicationMailer < ActionMailer::Base
  default from: "from@example.com"
  layout 'mailer'
end

class ApplicationMailer < ActionMailer::Base
  def self.no_reply_email_address
    name = "(Service Manual) DON'T REPLY"
    if GovukAdminTemplate.environment_label !~ /production/i
      name.prepend("[GOV.UK #{GovukAdminTemplate.environment_label}] ")
    end

    address = Mail::Address.new("inside-government@digital.cabinet-office.gov.uk")
    address.display_name = name
    address.format
  end

  default from: no_reply_email_address
  layout 'mailer'
end

Add default 'from' email address to NotificationMailer
Add default 'from' email address to NotificationMailer

We'll need a 'from' address for sending notifications. We're not planning to
parse reply emails so it has to be a DON'T REPLY address. Implementation
inspired by Whitehall's DO NOT REPLY [1]

[1] - https://github.com/alphagov/whitehall/blob/5631a1722e186b194f4f7bb1f53cd2eb56e48034/app/mailers/notifications.rb#L60-L69
