Sha256: 95ab3b22f144dc3da0a2cc2c129063dd5edca757b56c9dd80b39f1493c8b084c

Contents?: true

Size: 957 Bytes

Versions: 16

Compression:

Stored size: 957 Bytes

Contents

module Cmor::Contact
  class ContactRequestMailer < ApplicationMailer

    # Subject can be set in your I18n file at config/locales/en.yml
    # with the following lookup:
    #
    #   en.contact_request_mailer.notify.subject
    #
    def notify(contact_request)
      @contact_request = contact_request

      mail to: notification_recipients,
           from: notification_sender(contact_request),
           subject: notification_subject
    end

    private

    def notification_subject
      default_i18n_subject(application_name: Rails.application.class.to_s.split('::').first.underscore.humanize.titleize)
    end

    def notification_sender(contact_request)
      Cmor::Contact::Configuration.sender.call(contact_request)
      # "#{contact_request.name} <#{contact_request.email}>"
    end

    def notification_recipients
      ENV.fetch('CMOR_CONTACT_RECIPIENTS') { Cmor::Contact::Configuration.recipients.call(Rails.env) }
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
cmor_contact-0.0.60.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.59.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.58.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.57.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.56.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.55.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.54.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.53.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.52.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.51.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.50.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.49.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.48.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.45.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.44.pre app/mailers/cmor/contact/contact_request_mailer.rb
cmor_contact-0.0.43.pre app/mailers/cmor/contact/contact_request_mailer.rb