Sendgrid-php: using smtp not work, using curl not work. no error. and no response.

Created on 28 May 2020  路  9Comments  路  Source: sendgrid/sendgrid-php

using smtp not work, using curl not work. no error. and no response.

waiting for feedback question

Most helpful comment

The body is empty and I'd like to store a message ID in my database.

According to Response Example, the message identifier X-Message-Id is in the response headers, not the response body. The body is empty, as expected.

All 9 comments

the curl return empty response. how to solve this problem?

We definitely want to help you, but we really need more details to give you a good answer.

  • Do you use this library? If so, which version?
  • Can you post your (anonymized) code sample?
  • What PHP version do you use? (I expect you've verified extension curl was loaded)

Can you test your code locally using the PHP development php.ini configuration?

Thanks @kampalex 馃憤 (I forgot to hit the comment button when I added the labels 馃う )

i try to send using curl directly. i got empty response in terminal sir

Okay. You're using the curl command in a terminal session.
We still can't help you because you haven't provided used curl command.

I suggest to verify your composed request in app called 'Postman API Client'. It will help you to compose your request correctly, shows more response details and the resulting request can be displayed as a curl command.

The same thing happens to me. Status code I get is 202 (Accepted).

Here is my CURL:

curl --request POST \
  --url https://api.sendgrid.com/v3/mail/send \
  --header 'authorization: Bearer [TOKEN]' \
  --header 'content-type: application/json' \
  --data '{"personalizations": [{"to": [{"email": "[email protected]"}]}],"from": {"email": "[email protected]},"subject": "Hello World!","content": [{"type": "text/plain", "value": "Hello World!"}]}'

Sendgrid returns nothing, but I always receive an email.

Note that I have downloaded CA Root Certificate from https://curl.haxx.se/docs/caextract.html and implemented it in the loaded php.ini file like mentioned in #315.

@talovicnedim Please open a new issue if you've having a problem. But it sounds like you're getting back the expected 202 response code.

@childish-sambino
Ok, thanks! I will open a new issue. Yes, I'm getting the expected 202 status code. The body is empty and I'd like to store a message ID in my database.

The body is empty and I'd like to store a message ID in my database.

According to Response Example, the message identifier X-Message-Id is in the response headers, not the response body. The body is empty, as expected.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bjornmann picture bjornmann  路  3Comments

elshafey picture elshafey  路  4Comments

iamanupammaity picture iamanupammaity  路  4Comments

izhukovich picture izhukovich  路  4Comments

jverlee picture jverlee  路  4Comments