Allow User objects in From mail field and set Reply-To if not set already
This commit is contained in:
parent
b5c9634315
commit
c71b91a32f
2 changed files with 7 additions and 4 deletions
|
|
@ -63,7 +63,7 @@ class Mailer < ActionMailer::Base
|
|||
@feedback = feedback
|
||||
|
||||
mail to: FoodsoftConfig[:notification][:error_recipients],
|
||||
:from => "#{show_user user} <#{user.email}>",
|
||||
from: user,
|
||||
subject: I18n.t('mailer.feedback.subject', email: user.email)
|
||||
end
|
||||
|
||||
|
|
@ -78,6 +78,11 @@ class Mailer < ActionMailer::Base
|
|||
def mail(args)
|
||||
args[:subject] = "[#{FoodsoftConfig[:name]}] #{args[:subject]}"
|
||||
|
||||
if args[:from].is_a? User
|
||||
args[:reply_to] = args[:from] unless args[:reply_to]
|
||||
args[:from] = "#{show_user args[:from]} via #{I18n.t('layouts.foodsoft')} <#{FoodsoftConfig[:email_sender]}>"
|
||||
end
|
||||
|
||||
[:bcc, :cc, :reply_to, :sender, :to].each do |k|
|
||||
user = args[k]
|
||||
args[k] = "#{show_user user} <#{user.email}>" if user.is_a? User
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue