Last active
February 9, 2019 22:59
-
-
Save mega-arbuz/c7146a9f6c808f89752b70ee284e7da0 to your computer and use it in GitHub Desktop.
Send email with Zapier hook
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
ZAPIER_SEND_DATA = { | |
"to": None, | |
"subject": None, | |
"body": None | |
} | |
def send_email(zapier_hook, to, subject, body): | |
ZAPIER_SEND_DATA['to'] = to | |
ZAPIER_SEND_DATA['subject'] = subject | |
ZAPIER_SEND_DATA['body'] = body | |
headers = {'Content-Type': 'application/json'} | |
r = requests.post(zapier_hook, data=json.dumps(ZAPIER_SEND_DATA), headers=headers) | |
return r.status_code == requests.codes.ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment