feat: forward attachments instead

This commit is contained in:
Thifaine Noirault 2020-05-29 17:32:21 +02:00
parent c4ccfd7310
commit 6c1aedd2ae
1 changed files with 0 additions and 20 deletions

View File

@ -37,7 +37,6 @@ class BluescaleMailApi
$notifiable_recipient = false; $notifiable_recipient = false;
$notifiable_email = $notifiable->email; $notifiable_email = $notifiable->email;
$recipients = $template->recipients; $recipients = $template->recipients;
$attachments = $template->attachments;
if (count($recipients) > 0) if (count($recipients) > 0)
foreach ($recipients as $recipient) foreach ($recipients as $recipient)
@ -50,27 +49,8 @@ class BluescaleMailApi
'address' => $notifiable->email 'address' => $notifiable->email
]; ];
} }
$files = [];
if (count($attachments) > 0)
foreach ($attachments as $attachment)
$files[] = [
'name' => $attachment['name'],
'contents' => $attachment['content'],
'filename' => $attachment['filename'],
];
try { try {
if (count($attachments) > 0) {
return $client->request('post', $url, [
'multipart' => $files,
'form_params' => $template,
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
'Accept' => 'application/json'
]
])->getBody();
}
return $client->request('post', $url, [ return $client->request('post', $url, [
'form_params' => $template, 'form_params' => $template,
'headers' => [ 'headers' => [