From 23ebe8d6e906076a6686e8993b4e5d371eb920e3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 13 Mar 2023 18:30:05 +1100 Subject: [PATCH] Fixes for sending from email name --- app/Services/Email/EmailDefaults.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Services/Email/EmailDefaults.php b/app/Services/Email/EmailDefaults.php index 476ab592cd..3493c2201e 100644 --- a/app/Services/Email/EmailDefaults.php +++ b/app/Services/Email/EmailDefaults.php @@ -127,7 +127,15 @@ class EmailDefaults private function setFrom(): self { if (Ninja::isHosted() && $this->email->email_object->settings->email_sending_method == 'default') { - $this->email->email_object->from = new Address(config('mail.from.address'), $this->email->company->owner()->name()); + + if ($this->email->company->account->isPaid() && property_exists($this->email->email_object->settings, 'email_from_name') && strlen($this->email->email_object->settings->email_from_name) > 1) { + $email_from_name = $this->email->email_object->settings->email_from_name; + } else { + $email_from_name = $this->email->company->present()->name(); + } + + $this->email->email_object->from = new Address(config('mail.from.address'), $email_from_name); + return $this; }