$transport =
new MailerSendApiTransport('ACCESS_KEY',
$client);
$mail =
new Email();
$mail->
subject('Test subject'
) ->
to(new Address('test_to@example.com', 'Test to name'
)) ->
from(new Address('test_from@example.com', 'Test from name'
)) ->
addCc('test_cc@example.com'
) ->
addBcc('test_bcc@example.com'
) ->
addReplyTo('test_reply_to@example.com'
) ->
html('<html><body><p>Lorem ipsum.</p><img src="cid:test_cid@symfony"></body></html>'
) ->
addPart(new DataPart('content', 'attachment.txt', 'text/plain'
)) ->
addPart((new DataPart('inline content', 'inline.txt', 'text/plain'
))->
asInline()->
setContentId('test_cid@symfony'
));
$message =
$transport->
send($mail);
$this->
assertSame('test_message_id',
$message->
getMessageId());
} public function testSendThrowsForErrorResponse() { $client =
new MockHttpClient(function Dstring
$method, string
$url, array
$options): ResponseInterface
{ return new MockResponse(json_encode(['message' => 'i\'m a teapot'
]),
[ 'http_code' => 418,
]);