Sha256: da4f60d0a6e7a2f2204338389257345578d4a13c9c5573499af86048783c3e01

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

module Fe
  class Notifier < ActionMailer::Base

    # call Notifier.deliver_notification
    def notification(p_recipients, p_from, template_name, template_params = {}, options = {})
      email_template = EmailTemplate.find_by_name(template_name)

      if email_template.nil?
        raise "Email Template #{template_name} could not be found"
      else
        mail(:to => p_recipients,
             :from => p_from,
             :subject => Liquid::Template.parse(email_template.subject).render(template_params),
             :body => Liquid::Template.parse(email_template.content).render(template_params))
        @recipients = p_recipients
        @from = p_from
        @subject = Liquid::Template.parse(email_template.subject).render(template_params)
        @body = Liquid::Template.parse(email_template.content).render(template_params)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fe-0.0.4 app/mailers/fe/notifier.rb