Skip to content

Instantly share code, notes, and snippets.

@mega-arbuz
Last active February 9, 2019 22:59
Show Gist options
  • Save mega-arbuz/c7146a9f6c808f89752b70ee284e7da0 to your computer and use it in GitHub Desktop.
Save mega-arbuz/c7146a9f6c808f89752b70ee284e7da0 to your computer and use it in GitHub Desktop.
Send email with Zapier hook
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