| @@ -1,48 +1,0 @@ | ||
| 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 | - //https://developers.brevo.com/docs/send-a-transactional-email | |
| 8 | - if ($sendingMethod != plgAcymSendinblue::SENDING_METHOD_ID) return; | |
| 9 | - $data = [ | |
| 10 | - 'sender' => $from, | |
| 11 | - 'replyTo' => $reply_to, | |
| 12 | - 'to' => [ | |
| 13 | - [ | |
| 14 | - 'email' => acym_strtolower($to['email']), | |
| 15 | - ], | |
| 16 | - ], | |
| 17 | - 'subject' => $subject, | |
| 18 | - 'htmlContent' => $body, | |
| 19 | - ]; | |
| 20 | - | |
| 21 | - if (!empty($bcc)) { | |
| 22 | - $data['bcc'] = [ | |
| 23 | - [ | |
| 24 | - 'email' => $bcc[0][0], | |
| 25 | - ], | |
| 26 | - ]; | |
| 27 | - } | |
| 28 | - | |
| 29 | - if (!empty($attachments)) { | |
| 30 | - $data['attachment'] = []; | |
| 31 | - foreach ($attachments as $key => $attachment) { | |
| 32 | - $data['attachment'][] = [ | |
| 33 | - 'content' => $attachment['contentEncoded'], | |
| 34 | - 'name' => $attachment[1], | |
| 35 | - ]; | |
| 36 | - } | |
| 37 | - } | |
| 38 | - | |
| 39 | - $responseMailer = $this->callApiSendingMethod('smtp/email', $data, $this->headers, 'POST'); | |
| 40 | - | |
| 41 | - if (!empty($responseMailer['code'])) { | |
| 42 | - $response['error'] = true; | |
| 43 | - $response['message'] = $responseMailer['message']; | |
| 44 | - } else { | |
| 45 | - $response['error'] = false; | |
| 46 | - } | |
| 47 | - } | |
| 48 | -} | |