Class: CreateDailySpoolFilesMailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/create_daily_spool_files_mailer.rb

Instance Method Summary collapse

Instance Method Details

#build(region = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/mailers/create_daily_spool_files_mailer.rb', line 6

def build(region = nil)
  date = Time.zone.now.strftime('%m%d%Y')
  rpo_msg = if region.nil?
              'files'
            else
              "file for #{EducationForm::EducationFacility.rpo_name(region:)}"
            end
  opt = {}
  opt[:to] =
    if FeatureFlipper.staging_email?
      Settings.edu.spool_error.staging_emails.dup
    else
      Settings.edu.spool_error.emails.dup
    end

  mail(
    opt.merge(
      subject: "Error Generating Spool file on #{date}",
      body: "There was an error generating the spool #{rpo_msg} on #{date}"
    )
  )
end