Last active
September 30, 2020 11:32
-
-
Save bdeanindy/d31ef1550f3a65b02d19 to your computer and use it in GitHub Desktop.
cURL POST Example to send an email using the SparkPost Transmissions API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: <REPLACE_WITH_YOUR_API_KEY>" \ | |
-X POST -d '{"options":{"open_tracking":true,"click_tracking":true},"return_path":"bounces@<REPLACE_WITH_YOUR_SENDING_DOMAIN_HERE>","metadata":{"some_useful_metadata":"testing_sparkpost"},"substitution_data":{"signature":"<REPLACE_WITH_YOUR_FIRST_AND_LAST_NAME>"},"recipients":[{"address":{"email":"<REPLACE_WITH_YOUR_EMAIL_ADDRESS>","tags":["learning"],"substitution_data":{"customer_type":"Platinum","first_name":"<REPLACE_WITH_YOUR_FIRST_NAME>"}}}],"content":{"from":{"name":"Awesome Company","email":"testing@<REPLACE_WITH_YOUR_SENDING_DOMAIN>"},"subject":"My first SparkPost Transmission","reply_to":"Awesome Company ","text":"Hi {{address.first_name}}\r\nYou have just sent your first email through SparkPost!\r\nCongratulations,\r\n{{signature}}","html":"<strong>Hi {{address.first_name}},</strong><p>You have just sent your first email through SparkPost!</p><p>Congratulations!</p>{{signature}}"}}' \ | |
https://api.sparkpost.com/api/v1/transmissions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much I appreciate this post.