Skip to content

Instantly share code, notes, and snippets.

@ethandrower
Created October 12, 2019 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethandrower/a72632c81674426a66a68f6a5c93a16d to your computer and use it in GitHub Desktop.
Save ethandrower/a72632c81674426a66a68f6a5c93a16d to your computer and use it in GitHub Desktop.
Quick PythonRequests Mailgun Email Function
import requests
def send_alert(mailgun_domain, to_email, from_email, subject, message):
email_text = """Sample Message Formatted \n \n
Status: {0} \n
""".format(str(message) )
return requests.post(
"https://api.mailgun.net/v3/" + mailgun_domain + "/messages",
auth=("api", "api-key-goes-here"),
data={"from": from_email ,
"to": [to_email, ""],
"subject": subject,
"text": email_text})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment