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
/* test1.php */
<?php
require_once (__DIR__ . '/vendor/autoload.php');
use Omnimail\Email;
use Omnimail\Sendgrid;
$mailer = new Sendgrid(MY_REAL_LIFE_SG_KEY);
$email = (new Email())
->addTo('example@email.com')
->setFrom('example@email.com')
->setSubject('Hello, world!')
->setTextBody('Hello World! How are you?');
$mailer->send($email);
/* test2.php */
<?php
require_once (__DIR__ . '/vendor/autoload.php');
$from = new SendGrid\Email("Example User", "test@example.com");
$subject = "Sending with SendGrid is Fun";
$to = new SendGrid\Email("Example User", "test@example.com");
$content = new SendGrid\Content("text/plain", "and easy to do anywhere, even with PHP");
$mail = new SendGrid\Mail($from, $subject, $to, $content);
$sg = new \SendGrid(MY_REAL_LIFE_SG_KEY);
$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
print_r($response->headers());
echo $response->body();
$ php test1.php
PHP Fatal error: Uncaught exception 'Omnimail\Exception\InvalidRequestException' in C:\Users\jschilz\test\vendor\omnimail\omnimail\src\Sendgri
d.php:137
Stack trace:
#0 C:\Users\jschilz\test\test1.php(15): Omnimail\Sendgrid->send(Object(Omnimail\Email))
#1 {main}
thrown in C:\Users\jschilz\test\vendor\omnimail\omnimail\src\Sendgrid.php on line 137
Fatal error: Uncaught exception 'Omnimail\Exception\InvalidRequestException' in C:\Users\jschilz\test\vendor\omnimail\omnimail\src\Sendgrid.php
on line 137
Omnimail\Exception\InvalidRequestException: in C:\Users\jschilz\test\vendor\omnimail\omnimail\src\Sendgrid.php on line 137
Call Stack:
0.0002 124920 1. {main}() C:\Users\jschilz\test\test1.php:0
0.0056 425304 2. Omnimail\Sendgrid->send() C:\Users\jschilz\test\test1.php:15
I put some debugging statements inside SendGrid.php to determine that SendGrid is returning a 502 Bad Gateway response.
I'm getting a bad gateway error when sending an e-mail with SendGrid. I've confirmed that:
I can reproduce as follows:
I put some debugging statements inside
SendGrid.php
to determine that SendGrid is returning a 502 Bad Gateway response.I can work to trouble shoot this tomorrow, but I thought I'd post the issue tonight incase the solution is obvious to you. (:
The text was updated successfully, but these errors were encountered: