Drymail is a minimalist wrapper over Python’s existing smtplib and email libraries, designed to be friendly but unrestrictive.
Makes sending emails easy and DRY — For Python 3.
Drymail is a minimalist wrapper over Python’s existing smtplib and email libraries, designed to be friendly but unrestrictive. Here’s how you might send a simple email with an attachment using drymail.
from drymail import SMTPMailer, Message client = SMTPMailer(host='smtp.email.com', user='johndoe', password='password', tls=True) message = Message(subject='Congrats on the new job!', sender=('John Doe', 'email@example.com'), receivers=[('Jane Doe', 'firstname.lastname@example.org'), 'email@example.com'], text='When is the party? ;)') with open('congrats.pdf', 'rb') as pdf_file: message.attach(filename='congrats.pdf', data=pdf_file.read(), mimetype='application/pdf') client.send(message)
- Supports creating email with HTML content, plaintext content, or both!
- Supports mentioning contacts in the
“John Doe" <firstname.lastname@example.org>format.
- Support standard headers like
- Supports injecting custom headers.
- Supports adding attachments.
- And most importantly — the library being minimalist, it doesn’t restrict you in any way like some of the most fancier email frameworks do.
drymail by running —
$ pip3 install drymail
Documentation is available at https://drymail.readthedocs.io/
- Test suite.
- Restructure the
Messageclass to handle dynamic
All kinds of contribution are welcome.
This project is licensed under the MIT license.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.