Metadata-Version: 2.4
Name: mailsend
Version: 2.0.0
Summary: Fork of tinysmtp with bug fixes and Python 3 compatibility
Author-email: Oliver Cope <oliver@redgecko.org>, Rick Harris <rconradharris@gmail.com>
License: BSD-3-Clause
Project-URL: homepage, https://hg.sr.ht/~olly/mailsend
Keywords: tinymtp,flask-mail,mail,smtp
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: envparse>=0.2
Dynamic: license-file

========
mailsend
========

This is a fork of
`Rick Harris's tinysmtp package <http://github.com/rconradharris/tinysmtp>`_
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)
