我有一个无法解决的问题,对我来说似乎很奇怪。 使用Mailjet发送基本邮件时出现错误。
这是我的代码:
$mj = new \Mailjet\Client("###", "###",true,['version' => 'v3.1']);
$body = [
'Messages' => [
[
'From' => [
'Email' => "contact@mail.com",
'Name' => "Me"
],
'To' => [
'Email' => "contact@mail.com",
'Name' => "You",
],
'Subject' => "New message",
'TextPart' => $message,
'HTMLPart' => $message
]
]
];
$response = $mj->post(Resources::$Email, ['body' => $body]);
var_dump($response->getData());
这是我的答案:
array(5) { ["ErrorIdentifier"]=> string(36) "c3d1817e-3571-4b6b-b58f-c1f53eb48fe7" ["ErrorCode"]=> string(7) "mj-0004" ["StatusCode"]=> int(400) ["ErrorMessage"]=> string(38) "Type mismatch. Expected type "Emails"." ["ErrorRelatedTo"]=> array(1) { [0]=> string(11) "Messages.To" } }
我在网上找不到任何类似的问题...
有什么想法吗?非常感谢