Sha256: 63683c016ae8c67bedf34bad5ad0dfb8ca8ebc426b9dde7705db574285d57504

Contents?: true

Size: 871 Bytes

Versions: 5

Compression:

Stored size: 871 Bytes

Contents

module C80OrderForm
  class MessageOrderMailer < ActionMailer::Base

    default from: Proc.new { SiteProp.first.mail_from },
            to: Proc.new { SiteProp.first.mail_to }

    def send_mess(message, subject)
      @message = format_message(message)

      puts "<MessageOrderMailer.send_mess> Отправляем сообщение."
      mail(subject: subject) do |format|
        format.html { render "mail_mess" }
      end

      #puts "#{SiteProps.first.mail_to}"
    end

    # private

    def format_message(message)
      m = Settings.first.message_text
      m = m.gsub!('{name}',message.name)
      m = m.gsub!('{email_or_phone}',message.email_or_phone)
      m = m.gsub!('{comment}',message.comment)
      m = m.gsub!('{subj_id}',message.subj_id)
      # puts "<format_message> m: #{m}"
      message.update(:comment => m)
      m
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
c80_order_form-0.1.0.7 app/mailers/c80_order_form/message_order_mailer.rb
c80_order_form-0.1.0.6 app/mailers/c80_order_form/message_order_mailer.rb
c80_order_form-0.1.0.5 app/mailers/c80_order_form/message_order_mailer.rb
c80_order_form-0.1.0.4 app/mailers/c80_order_form/message_order_mailer.rb
c80_order_form-0.1.0.3 app/mailers/c80_order_form/message_order_mailer.rb