| 1 |
<?php |
| 2 |
|
| 3 |
class SendinblueTransactional extends SendinblueClass |
| 4 |
{ |
| 5 |
public function sendTransactionalEmail(&$response, $sendingMethod, $to, $subject, $from, $reply_to, $body, $bcc = [], $attachments = []) |
| 6 |
{ |
| 7 |
if ($sendingMethod != plgAcymSendinblue::SENDING_METHOD_ID) return; |
| 8 |
$data = [ |
| 9 |
'sender' => $from, |
| 10 |
'replyTo' => $reply_to, |
| 11 |
'to' => [ |
| 12 |
[ |
| 13 |
'email' => acym_strtolower($to['email']), |
| 14 |
], |
| 15 |
], |
| 16 |
'subject' => $subject, |
| 17 |
'htmlContent' => $body, |
| 18 |
]; |
| 19 |
|
| 20 |
if (!empty($bcc)) { |
| 21 |
$data['bcc'] = [ |
| 22 |
[ |
| 23 |
'email' => $bcc[0][0], |
| 24 |
], |
| 25 |
]; |
| 26 |
} |
| 27 |
|
| 28 |
if (!empty($attachments)) { |
| 29 |
$data['attachment'] = []; |
| 30 |
foreach ($attachments as $key => $attachment) { |
| 31 |
$data['attachment'][] = [ |
| 32 |
'content' => $attachment['contentEncoded'], |
| 33 |
'name' => $attachment[1], |
| 34 |
]; |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
$responseMailer = $this->callApiSendingMethod('smtp/email', $data, $this->headers, 'POST'); |
| 39 |
|
| 40 |
if (!empty($responseMailer['code'])) { |
| 41 |
$response['error'] = true; |
| 42 |
$response['message'] = $responseMailer['message']; |
| 43 |
} else { |
| 44 |
$response['error'] = false; |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
|