Fixes for From name for client password reset

This commit is contained in:
David Bomba 2022-01-18 10:52:40 +11:00
parent a6799c070e
commit 3cf5ae9056
2 changed files with 15 additions and 1 deletions

View File

@ -35,7 +35,13 @@ class NinjaMailer extends Mailable
public function build() public function build()
{ {
return $this->from(config('mail.from.address'), config('mail.from.name')) $from_name = config('mail.from.name');
if(property_exists($this->mail_obj, 'from_name')){
$from_name = $this->mail_obj->from_name;
}
return $this->from(config('mail.from.address'), $from_name)
->subject($this->mail_obj->subject) ->subject($this->mail_obj->subject)
->view($this->mail_obj->markdown, $this->mail_obj->data) ->view($this->mail_obj->markdown, $this->mail_obj->data)
->withSwiftMessage(function ($message) { ->withSwiftMessage(function ($message) {

View File

@ -22,6 +22,7 @@ class ClientContactResetPasswordObject
public $token; public $token;
private $company; private $company;
/** /**
* *
*/ */
@ -52,12 +53,19 @@ class ClientContactResetPasswordObject
'logo' => $this->company->present()->logo(), 'logo' => $this->company->present()->logo(),
]; ];
$email_from_name = config('mail.from.name');
if(property_exists($settings, 'email_from_name') && strlen($settings->email_from_name) > 1)
$email_from_name = $settings->email_from_name;
else
$email_from_name = $this->company->present()->name();
$mail_obj = new \stdClass; $mail_obj = new \stdClass;
$mail_obj->subject = ctrans('texts.your_password_reset_link'); $mail_obj->subject = ctrans('texts.your_password_reset_link');
$mail_obj->data = $data; $mail_obj->data = $data;
$mail_obj->markdown = 'email.client.generic'; $mail_obj->markdown = 'email.client.generic';
$mail_obj->tag = $this->company->company_key; $mail_obj->tag = $this->company->company_key;
$mail_obj->from_name = $email_from_name;
return $mail_obj; return $mail_obj;
} }