feature/add-attachments #2
|
@ -37,7 +37,6 @@ class BluescaleMailApi
|
|||
$notifiable_recipient = false;
|
||||
$notifiable_email = $notifiable->email;
|
||||
$recipients = $template->recipients;
|
||||
$attachments = $template->attachments;
|
||||
|
||||
if (count($recipients) > 0)
|
||||
foreach ($recipients as $recipient)
|
||||
|
@ -50,27 +49,8 @@ class BluescaleMailApi
|
|||
'address' => $notifiable->email
|
||||
];
|
||||
}
|
||||
$files = [];
|
||||
if (count($attachments) > 0)
|
||||
foreach ($attachments as $attachment)
|
||||
$files[] = [
|
||||
'name' => $attachment['name'],
|
||||
'contents' => $attachment['content'],
|
||||
'filename' => $attachment['filename'],
|
||||
];
|
||||
|
||||
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, [
|
||||
'form_params' => $template,
|
||||
'headers' => [
|
||||
|
|
Loading…
Reference in New Issue