我正在使用sendgrid,我想设置我发送的电子邮件的样式,但在电子邮件中,他们显示原始代码我不知道为什么。有没有我做不正确的地方或什么?这是我写的代码...require 'vendor/autoload.php'; $email = new \SendGrid\Mail\Mail();$email->setFrom("my email address");$email->setSubject("Welcome");$email->addTo($EmailAddress);//Below code where i am having issues$email->addContent("text/plain", "<img src='Assets/images/logo.png'> Welcome To my channel...");$sendgrid = new \SendGrid('your api code');$sendgrid->send($email);
1 回答

慕后森
TA贡献1802条经验 获得超5个赞
您的内容类型错误。您必须将其设置为:text/html
$email->addContent("text/html", "<img src='Assets/images/logo.png'> Welcome To my channel...");
否则,即使您编写了 html,它也不会呈现为 html。
- 1 回答
- 0 关注
- 81 浏览
添加回答
举报
0/150
提交
取消