0
我使用SendGrid PHP API發送簡報,但是當我使用模板ID時,發送的郵件不包含CSS &圖像。SendGrid電子郵件模板樣式不應用
這裏是我的代碼:
<?php
require("sendgrid-php/sendgrid-php.php");
$from = new SendGrid\Email(null, "[email protected]");
$subject = "Hello World from the SendGrid PHP Library!";
$to = new SendGrid\Email(null, "[email protected]");
$content = new SendGrid\Content("text/plain", "hello");
$mail = new SendGrid\Mail($from, $subject, $to, $content);
$mail->setTemplateId("727274bc-XXXX-XXXX-XXXX-83a2b53597e5");
$apiKey = 'SG.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$sg = new \SendGrid($apiKey);
$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
echo $response->headers();
echo $response->body();
?>
希望有人能幫助我 感謝