以下是在PHP中使用Sendgrid发送电子邮件的代码。我去过Sendgrid文档。但我无法找到解决方案。提前谢谢。
<? php
require 'vendor/autoload.php';
require 'sendgrid-php/lib/SendGrid.php';
require 'sendgrid-php/lib/SendGrid/Email.php';
require 'sendgrid-php/lib/SendGrid/Response.php';
$sendgrid = new SendGrid('8ZArX0z3S6qOi1-xxxxx');
$email = new SendGrid\Email();
$email
->addTo("xxx@yahoo.com")
->setFrom("xxx@yahoo.com")
->setSubject("Subject goes here")
->setText("Hello World!")
->setHtml("<strong>Hello World!</strong>");
$sendgrid->send($email);
?>