Sha256: 8fefefebd0c1a4fe3a154c5aaac6d5080b979e4bf50d38aaa7806cfe901d8eb5

Contents?: true

Size: 739 Bytes

Versions: 8

Compression:

Stored size: 739 Bytes

Contents

module Ddr::Batch
  class BatchProcessorRunMailer < ActionMailer::Base

    def send_notification(batch)
      @batch = batch
      @title = "Batch Processor Run #{@batch.status}"
      @host = `uname -n`.strip
      @subject = "[#{@host}] #{@title}"
      attachments["details.txt"] = File.read(@batch.logfile.path)
      mail(from: from_address, to: @batch.user.email, subject: @subject)
    end

    private

    def from_address
      if Rails.application.config.action_mailer.default_options &&
              addr = Rails.application.config.action_mailer.default_options[:from]
        addr
      else
        raise Ddr::Batch::Error, 'Application config.action_mailer.default_options[:from] must be set'
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ddr-batch-2.0.1 app/mailers/ddr/batch/batch_processor_run_mailer.rb
ddr-batch-2.0.0.rc3 app/mailers/ddr/batch/batch_processor_run_mailer.rb
ddr-batch-2.0.0.rc2 app/mailers/ddr/batch/batch_processor_run_mailer.rb
ddr-batch-2.0.0.rc1 app/mailers/ddr/batch/batch_processor_run_mailer.rb
ddr-batch-2.0.0.beta.6 app/mailers/ddr/batch/batch_processor_run_mailer.rb
ddr-batch-2.0.0.beta.5 app/mailers/ddr/batch/batch_processor_run_mailer.rb
ddr-batch-2.0.0.beta.4 app/mailers/ddr/batch/batch_processor_run_mailer.rb
ddr-batch-2.0.0.beta.3 app/mailers/ddr/batch/batch_processor_run_mailer.rb