Created
October 12, 2019 06:08
-
-
Save ethandrower/a72632c81674426a66a68f6a5c93a16d to your computer and use it in GitHub Desktop.
Quick PythonRequests Mailgun Email Function
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
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