mailjet/mailjet-apiv3-php

Error Type mismatch. Expected type \"emailIn\". when using api v3.1

thinhtranquoc opened this issue · 1 comments

When I use CURL or PHP code same docs
https://dev.mailjet.com/email/reference/send-emails#v3_1_post_send

But shows error below. Could please help me workaround this issue?

{
    "ErrorIdentifier": "08ddfacc-bf6b-4a0d-9d39-eaccbdd322e9",
    "ErrorCode": "mj-0004",
    "StatusCode": 400,
    "ErrorMessage": "Type mismatch. Expected type \"emailIn\".",
    "ErrorRelatedTo": [
        "Messages.From"
    ]
}

Hi, @thinhtranquoc there seems to be issue with documentation
Remove brackets from body from key 'From' so it looks like this:

    'SandboxMode' => "true",
    'Messages' => [
      [
        'From' => [
            'Email' => "pilot@mailjet.com",
            'Name' => "Your Mailjet Pilot"
        ],
        'HTMLPart' => "<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
        'Subject' => "Your email flight plan!",
        'TextPart' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
        'To' => [
          [
            'Email' => "passenger@mailjet.com",
            'Name' => "Passenger 1"
          ]
        ]
      ]
    ]
  ];```