Skip to content

Instantly share code, notes, and snippets.

@dmregister
Created May 7, 2015 16:15
Show Gist options
  • Save dmregister/10aaa05d93c62a36a1cb to your computer and use it in GitHub Desktop.
Save dmregister/10aaa05d93c62a36a1cb to your computer and use it in GitHub Desktop.
mailer.py
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