Skip to content

Instantly share code, notes, and snippets.

@Gexos
Created October 14, 2014 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gexos/5a6789c281b0d80a305f to your computer and use it in GitHub Desktop.
Save Gexos/5a6789c281b0d80a305f to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import requests
request=requests.post(
'https://api.mailgun.net/v2/samples.mailgun.org/messages',
auth=("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"),
files=[("attachment", open("test.jpg"))],
data={"from":"foo@example.com",
"to": "bar@example.com",
"subject": "Hello",
"text": "Testing some Mailgun awesomness!",
"html": 'HTML version of the body'})
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