fix sib attachment
This commit is contained in:
parent
08d230befd
commit
725d6d7573
|
@ -3,6 +3,7 @@
|
|||
namespace Bluesquare\MailTemplates\Providers;
|
||||
|
||||
use Bluesquare\MailTemplates\MailTemplate;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use SendinBlue\Client\Api\TransactionalEmailsApi;
|
||||
use SendinBlue\Client\Model\SendSmtpEmail;
|
||||
use SendinBlue\Client\Model\SendSmtpEmailAttachment;
|
||||
|
@ -56,19 +57,23 @@ class SendinblueProvider implements TemplateMailProvider
|
|||
return new SendSmtpEmailTo($to);
|
||||
}, $data['recipients']));
|
||||
|
||||
if (! empty($config['redirect']))
|
||||
if (! empty($config['redirect'])) {
|
||||
Log::info("Redirecting SIB mail to: " . $config['redirect']);
|
||||
$model->setTo([
|
||||
new SendSmtpEmailTo([
|
||||
'email' => $config['redirect']
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
$model->setAttachment(array_map(function ($item) {
|
||||
$attachment = new SendSmtpEmailAttachment();
|
||||
$attachment->setName($item['filename']);
|
||||
$attachment->setContent(file_get_contents($item['path']));
|
||||
return $attachment;
|
||||
}, $data['attachments']));
|
||||
if (! empty($data['attachments'])) {
|
||||
$model->setAttachment(array_map(function ($item) {
|
||||
$attachment = new SendSmtpEmailAttachment();
|
||||
$attachment->setName($item['filename']);
|
||||
$attachment->setContent(file_get_contents($item['path']));
|
||||
return $attachment;
|
||||
}, $data['attachments']));
|
||||
}
|
||||
|
||||
$this->api->sendTransacEmail($model);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue