mailtools 3.0.1

Creator: codyrutscher

Last updated:

Add to Cart

Description:

mailtools 3.0.1

Mailtools
Writing a web application? Want to send some emails from it? Mailtools can
help!


Simple API for sending plain text messages, HTML and messages with
attachments.
ThreadedMailer sends emails in the background and returns control
to your application immediately, even when talking to slow remote servers.
Temporary sending failures are automatically retried.
Running your application in test mode? The RedirectMessages wrapper
routes emails to a test address and not to live email addresses.



Usage
Creating a simple SMTP mailer:
from mailtools import SMTPMailer
mailer = SMTPMailer('127.0.0.1')
This mailer will block until messages are sent and won’t retry failures. Use
ThreadedMailer to fix this:
mailer = ThreadedMailer(SMTPMailer('127.0.0.1'))
A mailer with TLS/STARTTLS support:
mailer = SMTPMailer('127.0.0.1', 465, transport_args={'security': 'TLS'})
mailer = SMTPMailer('127.0.0.1', transport_args={'security': 'STARTTLS'})
Sending a plain text message:
message = 'This is a plain text message'
mailer.send_plain(
'sender@example.com',
['recipient@example.com'],
'hi',
message
)
Sending an HTML message:
message = '<html><body>Look! HTML!</body></html>'
mailer.send_html(
'sender@example.com',
['recipient@example.com'],
'hi',
message
)
Adding attachments:
message = 'index.rst is attached to this message'
mailer.send_plain(
'sender@example.com',
['recipient@example.com'],
'hi',
message,
attachments=['index.rst']
)



CHANGELOG

3.0.1 (released 2019-11-06)

Fixed PyPI package metadata



3.0.0 (released 2019-11-06)

Added Python 3 support
Dropped Python 2 support



Version 2.1

Added a ThreadedMailer.shutdown method (thanks to Andrew Nelis for an
initial implementation and advice on the design of this feature)



Version 2

Added TLS/STARTTLS support (thanks to w31rd0 for the implementation of this)



Version 1

Initial release

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.