'MailPace-Server-Token' =>
$this->key,
'Content-Type' => 'application/json',
'User-Agent' => 'MailPace Symfony Mailer',
],
'json' =>
$this->
getPayload($email,
$envelope),
]);
try { $statusCode =
$response->
getStatusCode();
$result =
$response->
toArray(false
);
} catch (DecodingExceptionInterface
$e) { throw new HttpTransportException('Unable to send an email: '.
$response->
getContent(false
).
sprintf(' (code %d).',
$statusCode),
$response, 0,
$e);
} catch (TransportExceptionInterface
$e) { throw new HttpTransportException('Could not reach the remote MailPace endpoint.',
$response, 0,
$e);
} if (200 !==
$statusCode) { $errorMessage = 'Unable to send an email: ';
if (isset($result['error'
])) { $errorMessage .=
$result['error'
];
} elseif (isset($result['errors'
])) { $errors =
[];
foreach ($result['errors'
] as $key =>
$val) {