Skip to content
Python library to interact with Mailgun's v2 API.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
mailgun2
tests
.codeclimate.yml
.gitignore
.pyup.yml
CHANGELOG.rst
CONTRIBUTING.rst
LICENSE
MANIFEST.in
README.rst
requirements.txt
setup.cfg
setup.py
tox.ini

README.rst

python-mailgun2

PyPI Python Version

Codeship Status for albertyw/python-mailgun2 Code Climate Code Climate Test Coverage Dependency Status

Originally at https://github.com/ZeroCater/python-mailgun2

A super simple Python API for interacting with Mailgun. Currently only supports sending messages. Powered by Requests.

Works with Python 3!

Installation

pip install mailgun2

Usage

from mailgun2 import Mailgun
mailer = Mailgun('example.mailgun.org', 'public_key', 'private_key')
mailer.send_message(
    'from@yourdomain.com',
    ['to@you.com', 'others@you.com'],
    subject='Hi!',
    text='Sweet.'
    )

Required arguments:

from_email: string of email address to set as sender
to: list or string of email address to send to

Optional arguments:

subject: string subject of the email
text: string body of the email. Either text or html is required.
html: string HTML of the email. Either text or html is required.
cc: list of cc addresses.
bcc: list of bcc addresses.
tags: list of mailgun tags to associate with the email.
reply_to: Convenience argument for setting the Reply-To header
headers: Extra headers for messages
inlines: List of file paths to attach inline to the message
attachments: List of (file name, content type, file handle) as a multipart attachment

Contributing

See Contributing

Pull requests welcome!

Distributing

pip install twine
python setup.py sdist bdist_wheel
twine upload dist/*
You can’t perform that action at this time.