Skip to content

Instantly share code, notes, and snippets.

@zachwill
Created February 17, 2013 23:31
Show Gist options
  • Save zachwill/4974099 to your computer and use it in GitHub Desktop.
Save zachwill/4974099 to your computer and use it in GitHub Desktop.
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