feature/add-attachments #2
|
@ -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' => [
|
||||||
|
|
Loading…
Reference in New Issue