Skip to main content

Fork of tinysmtp with bug fixes and python 3 compatibility

Project description

This is a fork of Rick Harris’s tinysmtp package with a few fixes and Python 3 compatibility.

Example:

with Mail().connect() as mail:
    msg = Message(
        'alice@example.com', 'Subject', ['bob@example.com'], body='body')
    mail.send(msg)

Connections may be configured from a URL specified in an environment variable:

export MAILSEND_URL="smtp+tls://user:password@server.example.org/"

Or as individual variables:

export MAILSEND_HOSTNAME=server.example.org
export MAILSEND_PORT=25

Or in code:

mail = Mail('smtp://server.example.org/')
mail2 = Mail('server.example.org',
             port=25,
             ssl=True,
             username='x',
             password='x')

Call mail.send to send a message:

mail = Mail('smtp://server.example.org/')
mail.send(sender='alice@example.com',
          recipients=['bob@example.com', 'charlie@example.com'],
          body='Hello everyone!',
          html='<p>Hello everyone!</p>',
          subject='Hello')

Or use the message class to construct messages piecemeal:

msg = Message('alice@example.com', 'Hello!')
msg.body = 'Hello'
msg.recipients = ['bob@example.com']
msg.cc = ['charlie@example.org']
msg.bcc = ['dina@example.org']

mail = Mail('smtp://server.example.org/')
mail.send(msg)

To send multiple messages in a single connection, use Mail.connect:

with mail.connect() as conn:
    conn.send(msg1)
    conn.send(msg2)

1.1.1 (released 2020-06-19)

  • Add support for url quoted usernames/passwords in SMTP urls

1.1.0 (released 2020-06-18)

  • Add support for sending through commandline MTAs (sendmail etc)

1.0.3 (released 2019-12-02)

  • Bugfix: no longer request the SMTPUTF8 extension for addresses that do not appear in SMTP commands.

1.0.2 (released 2019-11-28)

  • Fixed broken 1.0.1 release

1.0.1 (released 2019-11-28)

  • Bugfix: Mail.send() now sets the envelope from/to addresses correctly from message headers in the form “Name <address@example.com>”

1.0.0 (released 2019-11-27)

  • Dropped Python 2 support

  • Feature: Mail.send() now accepts optional keyword only arguments envelope_from and envelope_to.

0.1.5 (released 2019-06-18)

  • Bugfix: don’t add a duplicate Message-Id header if one is provided

0.1.4 (released 2017-08-27)

  • Bugfix: extra_headers option is now python 3 compatible

0.1.3 (released 2017-04-19)

  • Added ability to send stdlib email.message.Message objects via mailsend

0.1.2 (released 2016-09-02)

  • The mime structure of HTML emails is now compatible with Outlook 2011

  • The SMTPUTF8 extension is requested when messages contain utf-8 addresses. (feature is available in Python 3.5 only)

0.1.1 (released 2015-12-21)

  • Fixes for compatibility with envparse-0.2

0.1 (released 2015-12-19)

  • Forked from https://github.com/rconradharris/tinysmtp

  • Added configuration via URL (eg Connection('smtp://user@example.org'))

  • Various bug fixes

  • Added rewrite_to argument to Mail class constructor method. This causes all messages to be rewritten to the given address(es), and is expected to be used for development/testing.

  • Added bcc argument to Mail class constructor method. This causes all messages to be bcc’d to the given address(es).

  • Added suppress_send argument to the Mail class constructor. This causes messages to not be sent (but may be still accessed via Mail.subscribe)

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

mailsend-1.1.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

mailsend-1.1.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file mailsend-1.1.1.tar.gz.

File metadata

  • Download URL: mailsend-1.1.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.8.0 tqdm/4.41.1 CPython/3.7.7

File hashes

Hashes for mailsend-1.1.1.tar.gz
Algorithm Hash digest
SHA256 503cbff300537ab67d61db03ae220bce886494b060fc3b88fbc02175df3b2d4a
MD5 b2517a5cb937b4e62b86078ee40624c3
BLAKE2b-256 514213b2b29accdf8b228b52917acf73e4cf2d52f37c3e5ca4e6a82d4ca450a8

See more details on using hashes here.

File details

Details for the file mailsend-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: mailsend-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.8.0 tqdm/4.41.1 CPython/3.7.7

File hashes

Hashes for mailsend-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df9d220a409bf1ef5010150f087f4c96861013b8393de14c2b9cb38580a059bc
MD5 8a4f75c9748c6c3c613c9f6ab9505bd3
BLAKE2b-256 2b6db8524750064222d20347fb4fefc9f93a386ad3c0640c88ea82a21d85ffaa

See more details on using hashes here.

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