update
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Concerns;
|
||||
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
|
||||
trait BuildsTemplateEnvelope
|
||||
{
|
||||
protected function templateEnvelope(string $subject, array $mailConfig): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: $subject,
|
||||
from: $this->templateAddress($mailConfig['from_email'] ?? null, $mailConfig['from_name'] ?? null),
|
||||
replyTo: array_filter([$this->templateAddress($mailConfig['reply_to'] ?? null, $mailConfig['reply_to_name'] ?? null)]),
|
||||
cc: $mailConfig['cc'] ?? [],
|
||||
bcc: $mailConfig['bcc'] ?? [],
|
||||
);
|
||||
}
|
||||
|
||||
private function templateAddress(?string $email, ?string $name): ?Address
|
||||
{
|
||||
return $email ? new Address($email, $name) : null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user