From e9a162e71aedfd4afd6ebf4946a25e3cabf6cb84 Mon Sep 17 00:00:00 2001 From: Robert Guthrie Date: Fri, 11 Feb 2022 02:50:30 +1300 Subject: [PATCH] feat: Prefer reply-to over from in email channels (#3837) Co-authored-by: root --- app/presenters/mail_presenter.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/presenters/mail_presenter.rb b/app/presenters/mail_presenter.rb index d406b81be..4ad650db8 100644 --- a/app/presenters/mail_presenter.rb +++ b/app/presenters/mail_presenter.rb @@ -91,11 +91,11 @@ class MailPresenter < SimpleDelegator def from # changing to downcase to avoid case mismatch while finding contact - @mail.from.map(&:downcase) + (@mail.reply_to.presence || @mail.from).map(&:downcase) end def sender_name - Mail::Address.new(@mail[:from].value).name + Mail::Address.new((@mail[:reply_to] || @mail[:from]).value).name end def original_sender