Skip to content

Returning Error 500 #637

@ronaldo-mendonca-dos-santos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questionquestion directed at the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions