2017-03-29 5 views
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(); 

?> 

ホープ誰かが私に おかげで解決

答えて

1

を助けます!ちょうど変更する $content = new SendGrid\Content("text/plain", "hello");$content = new SendGrid\Content("text/html", "hello");

関連する問題