Sha256: 057ab1b1a164763f4c03946b8a5e386ce92e209a11933dc9b4e6af12914aeed4

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

# encoding: utf-8

class AdminMailer < ActionMailer::Base
  before_action :default_headers
  default from: proc { "\"Pages\" <support@manualdesign.no>" }

  def error_report(error_report, from, description)
    @error_report, @from, @description = error_report, from, description
    short_message = @error_report[:message].gsub(/[\s\n]+/, " ")[0..80]
    mail(
      to:      "system+error@manualdesign.no",
      from:    "\"Error reports\" <system+error@manualdesign.no>",
      subject: "[#{PagesCore.config(:site_name)}] Error: #{short_message}"
    )
  end

  def password_reset(user, url)
    @user, @url = user, url
    mail(
      to: @user.email,
      subject: "Reset your password on #{PagesCore.config(:site_name)}"
    )
  end

  def comment_notification(recipient, page, comment, url)
    @recipient, @page, @comment, @url = recipient, page, comment, url
    mail(
      to:      recipient,
      subject: "[#{PagesCore.config(:site_name)}] New comment on #{@page.name}"
    )
  end

  def invite(invite, url)
    @invite, @url = invite, url
    mail(
      to:      @invite.email,
      subject: "#{PagesCore.config(:site_name)} has invited you to Pages"
    )
  end

  private

  def default_headers
    headers("X-MC-Subaccount" => "pages")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pages_core-3.4.3 app/mailers/admin_mailer.rb
pages_core-3.4.2 app/mailers/admin_mailer.rb