update
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Mail\Concerns\BuildsTemplateEnvelope;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
@@ -16,7 +16,7 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class GenericTemplateMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
use Queueable, SerializesModels, BuildsTemplateEnvelope;
|
||||
|
||||
public function __construct(
|
||||
public readonly string $renderedSubject,
|
||||
@@ -26,22 +26,11 @@ class GenericTemplateMail extends Mailable
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: $this->renderedSubject,
|
||||
from: $this->address($this->mailConfig['from_email'] ?? null, $this->mailConfig['from_name'] ?? null),
|
||||
replyTo: array_filter([$this->address($this->mailConfig['reply_to'] ?? null, $this->mailConfig['reply_to_name'] ?? null)]),
|
||||
cc: $this->mailConfig['cc'] ?? [],
|
||||
bcc: $this->mailConfig['bcc'] ?? [],
|
||||
);
|
||||
return $this->templateEnvelope($this->renderedSubject, $this->mailConfig);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(htmlString: $this->renderedHtml);
|
||||
}
|
||||
|
||||
private function address(?string $email, ?string $name): ?Address
|
||||
{
|
||||
return $email ? new Address($email, $name) : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user