I am using SendGrid in my PHP application to send email to my users so they can reset their passwords. The thing is, everything works fine on localhost, but when I transfer my files to the server, I got printed the following response 0 Array ( [0] => ). The status code response I received when inspecting on Network is 200 OK, and on SendGrid this means Your message is valid, but it is not queued to be delivered. I have no idea why this is happening, any help?
$email = new SendGrid\Mail\Mail();
$email->setFrom("[email protected]", "Person");
$email->setSubject("Subject");
$email->addTo("[email protected]", "Person");
$email->addContent("text/plain", "This is the email.");
$email->addContent(
"text/html",
'<p>This is the email</p>'
);
$sendgrid = new \SendGrid('myKey');
try {
$response = $sendgrid->send($email);
print($response->statusCode());
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}