In the following code/file, I am trying to get current date in the final email.
But what I am getting is the variable $DATE itself in the email. Same for $from_email
and $to_email.
My question: is there a different way/method than using '
in --data
?
Here's my code:
NL=$'\n'
DATE=$(date)
DATE=${DATE%$NL}
echo $DATE
#
curl --request POST \
--url https://api.sendgrid.com/v3/mail/send \
--header "Authorization: Bearer $SENDGRID_CURL_API_KEY" \
--header 'Content-Type: application/json' \
--data '\
{
"personalizations": [{"to": [{"email": "$to_email"}]}],\
"from": {"email": "$from_email"},\
"subject": "SendGrid API $DATE",\
"content": [{"type": "text/plain", "value": "Sent on $DATE using Shell/Curl"}]\
}\
'