-
Notifications
You must be signed in to change notification settings - Fork 624
Description
I'm trying to use sendgrid, but when I send it and it goes to the page where the code from sendgrid returns me error 500, how could I solve this problem?
`<?php
require 'vendor/autoload.php'; // If you're using Composer (recommended)
// Comment out the above line if not using Composer
// require("./sendgrid-php.php");
// If not using Composer, uncomment the above line
$email = new \SendGrid\Mail\Mail();
$email->setFrom("email", "Example User");
$email->setSubject("Sending with SendGrid is Fun");
$email->addTo("email", "Example User");
$email->addContent("text/plain", "and easy to do anywhere, even with PHP");
$email->addContent(
"text/html", "and easy to do anywhere, even with PHP"
);
$sendgrid = new \SendGrid(getenv('passowordId'));
try {
$response = $sendgrid->send($email);
print $response->statusCode() . "\n";
print_r($response->headers());
print $response->body() . "\n";
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}`
I was able to log in normally via ssh
[root@ubuntu-s-1vcpu-1gb-nyc1-01 ~]# telnet smtp.sendgrid.net 2525 Trying 108.168.183.160... Connected to smtp.sendgrid.net. Escape character is '^]'. 220 SG ESMTP service ready at ismtpd0010p1iad1.sendgrid.net auth login 334 VXNlcm5hbWU6 login 334 UGFzc3dvcmQ6 senha 235 Authentication successful