Sendgrid-php: I have status: 0 in my response

Created on 10 Nov 2016  路  4Comments  路  Source: sendgrid/sendgrid-php

Hello,

I've just installed your API using composer. When I want to send mail from your API, it seems like everything have to be configured good. But, no email has been sent. I have get no error, No Exception, nothig...

My code:

                $from = new SendGrid\Email("Example User", "[email protected]");
        $subject = "Sending with SendGrid is Fun";
        $to = new SendGrid\Email("Example User", "[email protected]");
        $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 keey');

        try {
            $response = $sg->client->mail()->send()->post($mail);
        } catch (Exception $e) {
            echo 'Caught exception: ',  $e->getMessage(), "\n";
        }

        $this->sendJson([
            'status' => $response->statusCode(),
            'response' => $response->headers(),
            'body' => $response->body()
        ]);

And I get this:

` { "status": 0, "response": [ "" ], "body": "" }

Whats wrong????

question

Most helpful comment

I was facing the same problem and spent a couple of hours figuring out. I set the CURLOPT_SSL_VERIFYPEER in Client.php of sendGrid API.
_I have set CURLOPT_SSL_VERIFYPEER => to false instead of true_

image

All 4 comments

I get NGINX error.

@FilipLukac,

What is the NGINX error?

@thinkingserious - When I requested your service via CURL / Web / PostMan / CURL via PHP, I got 404 Nginx Error. It seems like your services not worked. Now, everything is fine, after couple of hours waiting.

I was facing the same problem and spent a couple of hours figuring out. I set the CURLOPT_SSL_VERIFYPEER in Client.php of sendGrid API.
_I have set CURLOPT_SSL_VERIFYPEER => to false instead of true_

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

buddyy93 picture buddyy93  路  5Comments

jverlee picture jverlee  路  4Comments

micahwalter picture micahwalter  路  3Comments

rsalunga29 picture rsalunga29  路  4Comments

solonifer picture solonifer  路  3Comments