Created
February 17, 2013 23:31
-
-
Save zachwill/4974099 to your computer and use it in GitHub Desktop.
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 as req | |
import simplejson as json | |
BASE_URL = "https://mandrillapp.com/api/1.0/" | |
MANDRILL_API_KEY = "lol-yeah" | |
def send(to, message, subject="Just Testing Mandrill"): | |
url = BASE_URL + "messages/send.json" | |
data = { | |
"key": MANDRILL_API_KEY, | |
"message": { | |
"text": message, | |
"subject": subject, | |
"from_email": "[email protected]", | |
"from_name": "Zach", | |
"to": [ | |
{ | |
"email": to | |
} | |
] | |
}, | |
"track_opens": True, | |
"track_clicks": True, | |
"async": True | |
} | |
json_data = json.dumps(data) | |
response = req.post(url, data=json_data) | |
return response | |
send("[email protected]", "What's up?") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment