我尝试使用sendgrid模板发送邮件并成功获取邮件,但替换无效。
$sendgrid = new \SendGrid(SEND_GRID_API);
$email = new \SendGrid\Mail\Mail();
$email->addTo($to, $first_name.' '.$last_name);
$email->setFrom("info.kickingworld@gmail.com", "Kicking World");
$email->setSubject($subject);
$email->addSubstitution("[Customer]", $first_name.' '.$last_name);
$email->addSubstitution("[Sender_Name]", "Kicking World");
$email->addSubstitution("[Sender_Address]", '');
$email->addSubstitution("[Sender_City]", '');
$email->addSubstitution("[Sender_State]", '');
$email->addSubstitution("[Sender_Zip]", '');
$email->addSubstitution("<%asm_group_unsubscribe_raw_url%>", '');
$email->addSubstitution("[Weblink]", '');
$email->addHeader('X-Sent-Using', 'SendGrid-API');
$email->addHeader('X-Transport', 'web');
$email->setTemplateId($template);
$response = $sendgrid->send($email);
获取邮件 [客户] 不是动态替换值。