(new MailjetApiTransport(self::USER, self::PASSWORD, sandbox: true
))->
setHost('example.com'
),
'mailjet+api://example.com?sandbox=true',
],
];
} public function testPayloadFormat() { $email =
(new Email()) ->
subject('Sending email to mailjet API'
) ->
replyTo(new Address('qux@example.com', 'Qux'
));
$email->
getHeaders() ->
addTextHeader('X-authorized-header', 'authorized'
) ->
addTextHeader('X-MJ-TemplateLanguage', 'forbidden'
); // This header is forbidden
$envelope =
new Envelope(new Address('foo@example.com', 'Foo'
),
[new Address('bar@example.com', 'Bar'
),
new Address('baz@example.com', 'Baz'
)]);
$transport =
new MailjetApiTransport(self::USER, self::PASSWORD
);
$method =
new \
ReflectionMethod(MailjetApiTransport::
class, 'getPayload'
);
$payload =
$method->
invoke($transport,
$email,
$envelope);
$this->
assertArrayHasKey('Messages',
$payload);
$this->
assertNotEmpty($payload['Messages'
]);