Update 'src/Providers/SendinblueProvider.php'

This commit is contained in:
Maxime 2023-01-16 01:09:35 +01:00
parent 463de25f28
commit a187e3fff0
1 changed files with 12 additions and 4 deletions

View File

@ -53,10 +53,6 @@ class SendinblueProvider implements TemplateMailProvider
if ($data['replyTo'])
$model->setReplyTo(new SendSmtpEmailReplyTo($data['replyTo']));
$model->setTo(array_map(function ($to) {
return new SendSmtpEmailTo($to);
}, $data['recipients']));
if (! empty($config['redirect'])) {
Log::info("Redirecting SIB mail to: " . $config['redirect']);
$model->setTo([
@ -65,6 +61,18 @@ class SendinblueProvider implements TemplateMailProvider
])
]);
}
elseif (count($data['recipients']) == 0 && ! empty($notifiable?->email)) {
$model->setTo([
new SendSmtpEmailTo([
'email' => $notifiable->email
])
]);
}
else {
$model->setTo(array_map(function ($to) {
return new SendSmtpEmailTo($to);
}, $data['recipients']));
}
if (! empty($data['attachments'])) {
$model->setAttachment(array_map(function ($item) {