From 0d1d31bfa92359d6a504fec573be6e235d93c5ce Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Tue, 3 Mar 2020 18:29:36 +0100 Subject: [PATCH] suite --- app/mailers/general_mails.rb | 3 +++ app/models/mail_hist.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/mailers/general_mails.rb b/app/mailers/general_mails.rb index 09e6aaf..3bdea05 100644 --- a/app/mailers/general_mails.rb +++ b/app/mailers/general_mails.rb @@ -61,6 +61,7 @@ class GeneralMails < ActionMailer::Base def general2(email_to, subject, body, mail_options = {}) @options = mail_options + @file_tunel = @options[:file_tunel] @m_odr = @options[:m_odr] @to = email_to @@ -77,6 +78,8 @@ class GeneralMails < ActionMailer::Base @from = @options[:from] elsif @m_odr and @m_odr.email_from? @from = @m_odr.email_from + elsif @file_tunel and @file_tunel.from_email? + @from = @file_tunel.from_email end if @from diff --git a/app/models/mail_hist.rb b/app/models/mail_hist.rb index 3999792..cca7373 100644 --- a/app/models/mail_hist.rb +++ b/app/models/mail_hist.rb @@ -91,7 +91,7 @@ class MailHist < ApplicationRecord elsif @m_odr and @m_odr.email_from? @from = @m_odr.email_from elsif @file_tunel and @file_tunel.from_email? - @file_tunel = @file_tunel.from_email + @from = @file_tunel.from_email end @@ -101,7 +101,7 @@ class MailHist < ApplicationRecord mail_history = MailHist.create(:lang_site => @lang_site, :to_email => @to_email, :from_email => @from, :element => options[:element], :subject => @subject, :body => @body, :m_odr => @m_odr, :m_odr_rep => @m_odr_rep, :mail_content => @mail_content, :mail_type => @mail_type) - mail = GeneralMails.general2(@to_email, @subject, @body, mail_options = {:m_odr => @m_odr}) + mail = GeneralMails.general2(@to_email, @subject, @body, mail_options = {:m_odr => @m_odr, :file_tunel => @file_tunel}) mail_history.subject_send = @subject mail_history.body_send = mail.body.encoded