Add sender_name in the SMTP reply mails (#6528)
This commit is contained in:
@@ -35,7 +35,6 @@ class ConversationReplyMailer < ApplicationMailer
|
|||||||
init_conversation_attributes(message.conversation)
|
init_conversation_attributes(message.conversation)
|
||||||
@message = message
|
@message = message
|
||||||
reply_mail_object = prepare_mail(true)
|
reply_mail_object = prepare_mail(true)
|
||||||
|
|
||||||
message.update(source_id: reply_mail_object.message_id)
|
message.update(source_id: reply_mail_object.message_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -115,6 +114,14 @@ class ConversationReplyMailer < ApplicationMailer
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def channel_email_with_name
|
||||||
|
if @conversation.assignee.present?
|
||||||
|
I18n.t('conversations.reply.channel_email.header.reply_with_name', assignee_name: assignee_name, from_email: @channel.email)
|
||||||
|
else
|
||||||
|
I18n.t('conversations.reply.channel_email.header.reply_with_inbox_name', inbox_name: @inbox.name, from_email: @channel.email)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def parse_email(email_string)
|
def parse_email(email_string)
|
||||||
Mail::Address.new(email_string).address
|
Mail::Address.new(email_string).address
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ module ConversationReplyMailerHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def email_from
|
def email_from
|
||||||
email_microsoft_auth_enabled || email_smtp_enabled ? @channel.email : from_email_with_name
|
email_microsoft_auth_enabled || email_smtp_enabled ? channel_email_with_name : from_email_with_name
|
||||||
end
|
end
|
||||||
|
|
||||||
def email_reply_to
|
def email_reply_to
|
||||||
|
|||||||
@@ -147,6 +147,10 @@ en:
|
|||||||
header:
|
header:
|
||||||
from_with_name: '%{assignee_name} from %{inbox_name} <%{from_email}>'
|
from_with_name: '%{assignee_name} from %{inbox_name} <%{from_email}>'
|
||||||
reply_with_name: '%{assignee_name} from %{inbox_name} <reply+%{reply_email}>'
|
reply_with_name: '%{assignee_name} from %{inbox_name} <reply+%{reply_email}>'
|
||||||
|
channel_email:
|
||||||
|
header:
|
||||||
|
reply_with_name: '%{assignee_name} from <%{from_email}>'
|
||||||
|
reply_with_inbox_name: '%{inbox_name} <%{from_email}>'
|
||||||
email_subject: "New messages on this conversation"
|
email_subject: "New messages on this conversation"
|
||||||
transcript_subject: "Conversation Transcript"
|
transcript_subject: "Conversation Transcript"
|
||||||
survey:
|
survey:
|
||||||
|
|||||||
@@ -168,6 +168,17 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
|
|||||||
expect(mail.delivery_method.settings[:address]).to eq 'smtp.gmail.com'
|
expect(mail.delivery_method.settings[:address]).to eq 'smtp.gmail.com'
|
||||||
expect(mail.delivery_method.settings[:port]).to eq 587
|
expect(mail.delivery_method.settings[:port]).to eq 587
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'renders assignee name in the from address' do
|
||||||
|
mail = described_class.email_reply(message)
|
||||||
|
expect(mail['from'].value).to eq "#{conversation.assignee.available_name} from <#{smtp_email_channel.email}>"
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders inbox name in the from address' do
|
||||||
|
conversation.update(assignee: nil)
|
||||||
|
mail = described_class.email_reply(message)
|
||||||
|
expect(mail['from'].value).to eq "#{smtp_email_channel.inbox.name} <#{smtp_email_channel.email}>"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when smtp enabled for microsoft email channel' do
|
context 'when smtp enabled for microsoft email channel' do
|
||||||
|
|||||||
Reference in New Issue
Block a user