Python Wrapper for Mandrill Inbound Email

jpadilla jpadilla Last update: Feb 10, 2021

Mandrill Inbound Python Wrapper Build Status

This is a simple API wrapper for Mandrill's inbound email webhookin Python inspired by this other Python wrapper library I made for Postmark Inbound.

Install

Using Github:

git clone git://github.com/jpadilla/mandrill-inbound-python.git

Using pip:

pip install python-mandrill-inbound

Using easy_install:

easy_install python-mandrill-inbound

Usage

from mandrill_inbound import MandrillInbound# Load from JSON stringjson_data = open('./tests/fixtures/valid_http_post.json').read()inbound = MandrillInbound(json=json_data)# Load Python dictionaryjson_data = json.loads(open('./tests/fixtures/valid_http_post.json').read())inbound = MandrillInbound(source=json_data)# Contentprint inbound.subjectprint inbound.senderprint inbound.toprint inbound.ccprint inbound.recipientsprint inbound.message_idprint inbound.mailbox_hashprint inbound.html_bodyprint inbound.text_bodyprint inbound.send_dateprint inbound.ts# Spam and Spoofing Detectionprint inbound.spfprint inbound.dkimprint inbound.spam_score# headersprint inbound.headers  # default to get all headersprint inbound.headers['MIME-Version']print inbound.headers['Received-SPF']# attachmentsprint inbound.has_attachments # booleanattachments = inbound.attachmentsfirst_attachment = attachments[0]print first_attachment.namesecond_attachment = attachments[1]print second_attachment.content_lengthfor a in attachments:	print a.name	print a.content_type	print a.read()	print a.download('./tests/', ['image/png'])# raw dataprint inbound.sourceprint inbound.msg

Bug tracker

Have a bug? Please create an issue here on GitHub!

Contributions

  • Fork
  • Write tests
  • Write Code
  • Pull request

Thanks for your help.

License

MIT License

Subscribe to our newsletter