Skip to main content

Python package to make it easier to handle email.

Project description

sremail

License Coverage Version

'SRE Mail' is a Python package designed to make sending email in MIME format a lot easier.

Basic usage

from datetime import datetime

from sremail import message, smtp

msg = message.Message(to=["Sam Gibson <sgibson@glasswallsolutions.com>", "a@b.com"],
                      from_addresses=["another@email.com"],
                      date=datetime.now(),
                      another_header="test")
             .attach("attachment.pdf")

smtp.send(msg, "smtp.some_server.com:25")

Gotchas

  • You can't add the X-FileTrust-Tenant header to a Message with a kwarg, as there's no way to format it in a general way due to the capitalised 'T' in 'Trust'. To get around this you have to add the header manually:
    msg = message.Message(to=["Sam Gibson <sgibson@glasswallsolutions.com>", "a@b.com"],
                      from_addresses=["another@email.com"],
                      date=datetime.now())
    msg.headers["X-FileTrust-Tenant"] = "<guid>"
    

Development

Prerequisites

  • Python 3.6+
  • Pipenv

Quick start

  1. Clone this repo.
  2. Run pipenv sync --dev.
  3. You're good to go. You can run commands using the package inside a pipenv shell, and modify the code with your IDE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sremail-1.0.1.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

sremail-1.0.1-py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page