1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 23:52:33 +01:00
invoiceninja/app/Jobs/Mail/NinjaMailer.php

54 lines
1.2 KiB
PHP
Raw Normal View History

2021-02-14 11:43:44 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2021-02-14 11:43:44 +01:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2021-02-14 11:43:44 +01:00
*/
2021-02-14 12:09:32 +01:00
namespace App\Jobs\Mail;
2021-02-14 11:43:44 +01:00
use Illuminate\Mail\Mailable;
class NinjaMailer extends Mailable
{
public $mail_obj;
/**
* Create a new message instance.
*
* @param $mail_obj
*/
public function __construct($mail_obj)
{
$this->mail_obj = $mail_obj;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$from_name = config('mail.from.name');
if (property_exists($this->mail_obj, 'from_name')) {
$from_name = $this->mail_obj->from_name;
}
$ninja_mailable = $this->from(config('mail.from.address'), $from_name)
2021-02-14 11:43:44 +01:00
->subject($this->mail_obj->subject)
2022-08-10 03:56:46 +02:00
->view($this->mail_obj->markdown, $this->mail_obj->data);
2022-03-04 01:45:19 +01:00
if (property_exists($this->mail_obj, 'text_view')) {
2022-03-04 01:45:19 +01:00
$ninja_mailable->text($this->mail_obj->text_view, $this->mail_obj->data);
}
return $ninja_mailable;
2021-02-14 11:43:44 +01:00
}
}