4

I can not send additional attributes from my site (API v3). In Template #1 I create text frame ID: {{ params.postid}} Name: {{ params.postname}} and from my site run my PHP code.

require_once($_SERVER['DOCUMENT_ROOT'] . '/sendinblue/vendor/autoload.php');
$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'key');
$apiInstance = new SendinBlue\Client\Api\SMTPApi( new GuzzleHttp\Client(), $config );
$templateId = 1; // int | Id of the template
$sendEmail = new \SendinBlue\Client\Model\SendEmail(); // \SendinBlue\Client\Model\SendEmail | 
$sendEmail ['emailTo'] = ['to-mail@mail.ru'];
$sendEmail ['attributes'] = ['postid'=>'12345', 'postname'=>'Post Title',];
try {
$result = $apiInstance->sendTemplate($templateId, $sendEmail);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling SMTPApi->sendTemplate: ', $e->getMessage(), PHP_EOL;
}

After I success get post on my mail with Template #1, but postid & postname empty. Help me, please!

0 Answers0