You are not logged in.
The following command (though I've replaced the sensitive API key with XXX) uses the sendgrid service to send an email.
curl --request POST --url https://api.sendgrid.com/v3/mail/send --header 'Authorization: Bearer XXX' --header 'Content-Type: application/json' --data '{"personalizations": [{"to": [{"email": "account@email.com"}]}],"from": {"email": "noreply@nodomain.com"},"subject": "Hi","content": [{"type": "text/html", "value": "Hello"}]}'
If I run it when I'm not connected to the internet, I receive the message (in my terminal emulator): "curl: (6) Could not resolve host: api.sendgrid.com". However, if I try to output this to a file, redirecting STDERR to STDOUT, the file (output.txt in the example below) never seems to receive the error message... Wondering how I can actually capture that error message. Maybe Curl is using something other than STDERR to report the error?
curl --request POST --url https://api.sendgrid.com/v3/mail/send --header 'Authorization: Bearer XXX' --header 'Content-Type: application/json' --data '{"personalizations": [{"to": [{"email": "account@email.com"}]}],"from": {"email": "noreply@nodomain.com"},"subject": "Hi","content": [{"type": "text/html", "value": "Hello"}]}' 2>&1 > output.txt
Offline
How about this?
curl ... >output.txt 2>&1
See https://www.gnu.org/software/bash/manua … tions.html for more details.
Offline