$result =
$response->
toArray(false
);
} catch (DecodingExceptionInterface
) { throw new HttpTransportException('Unable to send an email: '.
$response->
getContent(false
).
sprintf(' (code %d).',
$statusCode),
$response);
} catch (TransportExceptionInterface
$e) { throw new HttpTransportException('Could not reach the remote OhMySMTP endpoint.',
$response, 0,
$e);
} if (200 !==
$statusCode) { throw new HttpTransportException('Unable to send an email: '.
$response->
getContent(false
),
$response);
} $sentMessage->
setMessageId($result['id'
]);
return $response;
} private function getPayload(Email
$email, Envelope
$envelope): array
{ $payload =
[ 'from' =>
$envelope->
getSender()->
toString(),
'to' =>
implode(',',
$this->
stringifyAddresses($this->
getRecipients($email,
$envelope))),
'cc' =>
implode(',',
$this->
stringifyAddresses($email->
getCc())),
'bcc' =>
implode(',',
$this->
stringifyAddresses($email->
getBcc())),