1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-24 03:12:46 +01:00

Take into account mailbox From Name settings when sending a reply to customer from mailbox alias - closes #2976

This commit is contained in:
FreeScout 2023-05-04 23:18:49 -07:00
parent 6c949b18af
commit 56db1b8023

View File

@ -80,7 +80,7 @@ class ReplyToCustomer extends Mailable
$new_headers = $this->headers;
if (!empty($new_headers) || $from_alias) {
$mailbox = $this->mailbox;
$this->withSwiftMessage(function ($swiftmessage) use ($new_headers, $from_alias, $mailbox) {
$this->withSwiftMessage(function ($swiftmessage) use ($new_headers, $from_alias, $mailbox, $thread) {
if (!empty($new_headers)) {
if (!empty($new_headers['Message-ID'])) {
$swiftmessage->setId($new_headers['Message-ID']);
@ -102,6 +102,15 @@ class ReplyToCustomer extends Mailable
$from_alias_name = $aliases[$from_alias] ?? '';
// Take into account mailbox From Name setting.
$mailbox_mail_from = $mailbox->getMailFrom($thread->created_by_user, $thread->conversation);
if ($mailbox_mail_from['name'] == $mailbox->name && $from_alias_name) {
// Use name from alias.
} else {
// User name or custom.
$from_alias_name = $mailbox_mail_from['name'];
}
$swift_from = $headers->get('From');
if ($from_alias_name) {