Skip to content

Instantly share code, notes, and snippets.

@akfaew
Last active May 24, 2019 10:04
Show Gist options
  • Save akfaew/6ff2da8dba7f5577602e379150e94bee to your computer and use it in GitHub Desktop.
Save akfaew/6ff2da8dba7f5577602e379150e94bee to your computer and use it in GitHub Desktop.
GeekMail curl.sh Example
TEMPLATE=$(cat <<'END_TEMPLATE' | sed ':a;N;$!ba;s/\n/\\n/g'
To: {{ .To }}
Subject: Hello world!
{{ if .Name }}Hey {{ .Name }},{{ else }}Hey there,{{ end }}
I'm happy that you joined us.
--
Author
END_TEMPLATE
)
curl -X POST https://geekmail.app/api/1.0/draft/create \
-H "Content-Type: application/json" \
-d '{
"user_token":"TOKEN",
"template":'"\"$TEMPLATE\""',
"vars":{
"To":"John Doe <john@example.com>",
"Name":"John"
},
"labels":["GeekMail"]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment