4

我无法从我的站点 (API v3) 发送其他属性。在模板 #1 我创建文本框架 ID:{{ params.postid}} 名称:{{ params.postname}} 并从我的站点运行我的 PHP 代码。

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;
}

成功后,使用模板 #1 在我的邮件上发布,但 postid 和 postname 为空。请帮帮我!

4

0 回答 0