我正在尝试使用sendgrid的php解决方案发送电子邮件,按照github page上的说明安装sans作曲家。但PHP正在抛出一个
...找不到'SendGrid \ Email'类......
错误。这就是我所拥有的:
require("sendgrid-php/sendgrid-php.php");
$from = new SendGrid\Email(null, $fromemail);
$subject = "archive shared with you";
$to = new SendGrid\Email(null, $toemail);
$content = new SendGrid\Content("text/plain", $fromname . ' would like to ... Visit your page to see it. https://www.....com/login.php');
$mail = new SendGrid\Mail($from, $subject, $to, $content);
$apiKey = getenv('SENDGRID_API_KEY');
$sg = new \SendGrid($apiKey);
$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
echo $response->headers();
echo $response->body();
加载sendgrid-php / sendgrid-php.php文件没有问题。