Sha256: 5ce58b5554f3dfec57f92bb0cb1c51c5b93b7887405558fc99a2ab892f45e2fa

Contents?: true

Size: 876 Bytes

Versions: 3

Compression:

Stored size: 876 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.to_s)
      # puts "<format_message> m: #{m}"
      message.update(:comment => m)
      m
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
c80_order_form-0.1.0.10 app/mailers/c80_order_form/message_order_mailer.rb
c80_order_form-0.1.0.9 app/mailers/c80_order_form/message_order_mailer.rb
c80_order_form-0.1.0.8 app/mailers/c80_order_form/message_order_mailer.rb