|
1 | 1 | <?php |
| 2 | + |
2 | 3 | declare(strict_types=1); |
3 | 4 |
|
4 | 5 | /** |
@@ -43,7 +44,7 @@ class SendGridTransport extends AbstractTransport |
43 | 44 | 'uniqueIdField' => 'id', // The field name that stores the unique message ID char(36) uid |
44 | 45 | 'statusField' => 'status', // The field name that stores the status of the email char(50) status |
45 | 46 | 'statusMessageField' => 'status_message', // The field name that stores the status message TEXT status_message |
46 | | - ] |
| 47 | + ] |
47 | 48 | ]; |
48 | 49 |
|
49 | 50 | /** |
@@ -117,22 +118,22 @@ public function send(Message $message): array |
117 | 118 |
|
118 | 119 | $this->_reqParams['subject'] = $message->getSubject(); |
119 | 120 |
|
120 | | - // $this->_reqParams['custom_args'] ="{'email_msg_id': '106'}"; |
121 | | - |
122 | 121 | $emailFormat = $message->getEmailFormat(); |
123 | | - if (!empty($message->getBodyHtml())) { |
124 | | - $this->_reqParams['content'][] = (object)[ |
125 | | - 'type' => 'text/html', |
126 | | - 'value' => trim($message->getBodyHtml()), |
127 | | - ]; |
128 | | - } |
| 122 | + |
129 | 123 | if ($emailFormat == 'both' || $emailFormat == 'text') { |
130 | 124 | $this->_reqParams['content'][] = (object)[ |
131 | 125 | 'type' => 'text/plain', |
132 | 126 | 'value' => trim($message->getBodyText()), |
133 | 127 | ]; |
134 | 128 | } |
135 | 129 |
|
| 130 | + if (!empty($message->getBodyHtml())) { |
| 131 | + $this->_reqParams['content'][] = (object)[ |
| 132 | + 'type' => 'text/html', |
| 133 | + 'value' => trim($message->getBodyHtml()), |
| 134 | + ]; |
| 135 | + } |
| 136 | + |
136 | 137 | $this->_processHeaders($message); |
137 | 138 |
|
138 | 139 | $this->_processAttachments($message); |
@@ -271,7 +272,7 @@ protected function _sendEmail() |
271 | 272 | 'Authorization' => 'Bearer ' . $this->getConfig('apiKey'), |
272 | 273 | ], |
273 | 274 | ]; |
274 | | - |
| 275 | + |
275 | 276 |
|
276 | 277 | $response = $this->Client |
277 | 278 | ->post("{$this->getConfig('apiEndpoint')}/mail/send", json_encode($this->_reqParams), $options); |
|
0 commit comments