简体   繁体   中英

How to send a test email with personnalmessage in Mailjet campaign

I have a campaign and I send it with $mj->post to a contact list.

But I want to manage a test with the following code from the API

$response = $mj->post(Resources::$NewsletterTest, ['id' => $idNewsletter, 'body' => $body]);

But then I define the $body with a personnalmessage like this :

$body = [
    'Recipients' => [
        [
            'Email' => "myemail@myemail.com",
            'Name' => "John",
            'Vars' => [ 
            'personalmessage' => "Hello John this is a test"
            ]
        ]
    ]
];

I get the follwing error :

"Invalid json input:
object ".Recipients..item"->"TTestRecipient" has no property "Vars"" ["StatusCode"]=> int(400) 

And I do not understand how to correct the problem

When using NewsletterTest, you can specify only email address and name for the test recipients and can not use variables - https://dev.mailjet.com/email-api/v3/newsletter-test/

Personalisation is only available in Send API only - https://dev.mailjet.com/guides/#personalisation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM