-
Notifications
You must be signed in to change notification settings - Fork 627
Response returning zero status code #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @garyrutland, Unfortunately, I am unable to reproduce. Here is what I used: <?php
// If you are using Composer
require 'vendor/autoload.php';
// get sendgrid
$sendgrid = new \SendGrid(getenv('SENDGRID_API_KEY'));
// create sender and recipient
$from = new SendGrid\Email('App name', '[email protected]');
$to = new SendGrid\Email('Users name', '[email protected]');
// create subject and content
$subject = 'Email title';
$content = new SendGrid\Content('text/plain', 'Test content');
// create email
$mail = new SendGrid\Mail($from, $subject, $to, $content);
// send email
$result = $sendgrid->client->mail()->send()->post($mail); Which returned SendGrid\Response Object
(
[statusCode:protected] => 202
[body:protected] =>
[headers:protected] => Array
(
[0] => 1
)
) Does you email get delivered? |
I just came across this issue as well on a freshly installed Windows development machine, and for me it turned out to be the cURL PHP module missing CA certificates and thus refusing to connect to the SendGrid API. The issue can be resolved by downloading the required It would probably be a good idea to add some error detection to |
Sorry, for the late response but haven't had a chance to carry one working on this. |
I found that zero may return with curl error so need setup certificate for php to use this service , no option to disable |
@DvdGiessen it works like a charm! thanks! |
Since I'm still subscibed to this issue, I noticed the replies by @shahrpt and @apineda7 about how setting By doing so you're basically disabling an import part of your security, setting yourself up for a man-in-the-middle attack on your connections to SendGrid and potentially allowing an attacker to read, modify or do whatever else they want with the e-mails you try to send through SendGrid. Instead, as mentioned in my previous comment, fix the actual problem and you won't have to disable your security. See https://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/. @thinkingserious Any chance we could prioritize getting sendgrid/php-http-client#99 merged which would clear up the error message and next perhaps add a line about this specific issue in the documentation to prevent users from potentially shooting themselves in the foot by disabling |
@DvdGiessen thanks, setting up the curl.cainfo option inside php.ini fixed the problem for me 👍 |
@DvdGiessen I got curious. It would be good to know why this happens just in windows machines (if that's the case, as it seems to be). |
Issue Summary
Attempting to send mail has all of a sudden started returning zero response codes.
Steps to Reproduce
Technical details:
The text was updated successfully, but these errors were encountered: