Skip to content

Commit 416c5a8

Browse files
committed
PR#7
1 parent eff7818 commit 416c5a8

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

src/Mailer/Transport/SendGridTransport.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
/**
@@ -43,7 +44,7 @@ class SendGridTransport extends AbstractTransport
4344
'uniqueIdField' => 'id', // The field name that stores the unique message ID char(36) uid
4445
'statusField' => 'status', // The field name that stores the status of the email char(50) status
4546
'statusMessageField' => 'status_message', // The field name that stores the status message TEXT status_message
46-
]
47+
]
4748
];
4849

4950
/**
@@ -117,22 +118,22 @@ public function send(Message $message): array
117118

118119
$this->_reqParams['subject'] = $message->getSubject();
119120

120-
// $this->_reqParams['custom_args'] ="{'email_msg_id': '106'}";
121-
122121
$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+
129123
if ($emailFormat == 'both' || $emailFormat == 'text') {
130124
$this->_reqParams['content'][] = (object)[
131125
'type' => 'text/plain',
132126
'value' => trim($message->getBodyText()),
133127
];
134128
}
135129

130+
if (!empty($message->getBodyHtml())) {
131+
$this->_reqParams['content'][] = (object)[
132+
'type' => 'text/html',
133+
'value' => trim($message->getBodyHtml()),
134+
];
135+
}
136+
136137
$this->_processHeaders($message);
137138

138139
$this->_processAttachments($message);
@@ -271,7 +272,7 @@ protected function _sendEmail()
271272
'Authorization' => 'Bearer ' . $this->getConfig('apiKey'),
272273
],
273274
];
274-
275+
275276

276277
$response = $this->Client
277278
->post("{$this->getConfig('apiEndpoint')}/mail/send", json_encode($this->_reqParams), $options);

0 commit comments

Comments
 (0)