Created
May 7, 2015 16:15
-
-
Save dmregister/10aaa05d93c62a36a1cb to your computer and use it in GitHub Desktop.
mailer.py
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 | |
key = 'key' | |
sandbox = 'url' | |
recipient = '[email protected]' | |
def sendEmail(): | |
request_url = 'https://api.mailgun.net/v3/{0}/messages'.format(sandbox) | |
request = requests.post(request_url, auth=('api', key), data={ | |
'from': '[email protected]', | |
'to': recipient, | |
'subject': 'Hello', | |
'text': 'Hello from Mailgun' | |
}) | |
print 'Status: {0}'.format(request.status_code) | |
print 'Body: {0}'.format(request.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment