Merge branch '4.3' into 4.4
* 4.3: [Mailer] fixed Mailgun support when a response is not JSON as expected
This commit is contained in:
commit
cf57ca81ee
@ -62,9 +62,11 @@ class MailgunApiTransport extends AbstractApiTransport
|
||||
]);
|
||||
|
||||
if (200 !== $response->getStatusCode()) {
|
||||
$error = $response->toArray(false);
|
||||
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $response->toArray(false)['message'], $response->getStatusCode()), $response);
|
||||
}
|
||||
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $error['message'], $response->getStatusCode()), $response);
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $response->getContent(false), $response->getStatusCode()), $response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
@ -65,9 +65,11 @@ class MailgunHttpTransport extends AbstractHttpTransport
|
||||
]);
|
||||
|
||||
if (200 !== $response->getStatusCode()) {
|
||||
$error = $response->toArray(false);
|
||||
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $response->toArray(false)['message'], $response->getStatusCode()), $response);
|
||||
}
|
||||
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $error['message'], $response->getStatusCode()), $response);
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $response->getContent(false), $response->getStatusCode()), $response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
Reference in New Issue
Block a user