Sha256: 53c39f5576799801d2b80753bc87b5f9b4be095b5756da79d8ab103ee60d0f38

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

class NotificationMailer < ActionMailer::Base

  def notify(help_request)
    mail(to: recipients_list,
        from: config[:from] || 'no-reply@test.com',
        subject: "#{t('sufia.product_name')}: Help Request - #{help_request.id}",
        body: prepare_body(help_request))
  end

  private

  def prepare_body(help_request)
    body  = "From: #{help_request.user.email}\n"
    body += "URL: #{help_request.current_url}\n"
    body += "Javascript enabled: #{help_request.javascript_enabled}\n"
    body += "User Agent: #{help_request.user_agent}\n"
    body += "Resolution: #{help_request.resolution}\n"
    body += "Message: #{help_request.how_can_we_help_you}"
    body
  end

  def recipients_list
    return @list if !@list.nil?
    @list = YAML.load(File.open(File.join(Rails.root, "config/recipients_list.yml"))).split(" ")
    return @list
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
curate-0.3.1 app/mailers/notification_mailer.rb