You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SendGrid\Client::makeRequest(): Argument #3 ($body) must be of type ?array, SendGrid\Mail\Mail give called in /var/www/html/my-project/vendor/sendgrid/php-http-client/lib/Client.php on line 662
My code:
$fromEmail = "[email protected]";
$fromName = "Example Solutions";
$email = new Mail();
$email->setFrom($fromEmail, $fromName);
$email->addTo($Email, $Name);
$email->setSubject("Subject");
$email->addContent("text/plain", "Find attached the spec sheet.");
$email->addContent(
"text/html", "<strong>and easy to do anywhere, even with PHP</strong>"
);
$sendGrid = new \SendGrid($_ENV['SENDGRID_API_KEY']);
$sendGridResponse = $sendGrid->send($email);
if ($sendGridResponse->statusCode() === 202) {
} else {
throw new Exception("Caught exception: " . $sendGridResponse->body());
}
jazbek, nathantobin, dev2doublemweb, sstrycker-zspace, kamil-zacek and 1 more