Reusable library for sending HTML emails with images and attachments
Project description
Mailfeed
A reusable Python library for sending HTML emails with images and attachments.
Features
- Build HTML emails with embedded images
- Clean and normalize HTML content
- Send emails via SMTP
- Flexible configuration via dependency injection
- Type-safe interfaces
Installation
pip install mailfeed
For development:
pip install -e ".[dev]"
Quick Start
from mailfeed import EmailService
# Create email service
email_service = EmailService()
# Build email with images
images = {
'image1': '/path/to/image1.png',
'image2': '/path/to/image2.png'
}
msg = email_service.build_html_email(
from_email='sender@example.com',
to_email='recipient@example.com',
subject='Hello from Mailfeed',
text='Plain text version',
html='<html><body><h1>Hello</h1><img src="cid:image1"/></body></html>',
images=images
)
# Send via SMTP
email_service.send_smtp_email(
sender='sender@example.com',
recipient='recipient@example.com',
msg=msg,
host='smtp.example.com',
port=587,
smtp_username='username',
smtp_password='password'
)
HTML Normalization
from mailfeed import HTMLNormalizer, HTMLConfig
config = HTMLConfig(
email_image_width=600,
email_image_height=400,
email_image_border=0
)
normalizer = HTMLNormalizer(config)
clean_html = normalizer.clean_html(dirty_html)
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mailfeed-0.1.2.tar.gz
(7.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mailfeed-0.1.2.tar.gz.
File metadata
- Download URL: mailfeed-0.1.2.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b63a78b47c5860c1e77d35ede4a4fff3c939ec41e51068a0c9777807d82040d6
|
|
| MD5 |
e7f5875a85a7feb3c2e7467f126cd664
|
|
| BLAKE2b-256 |
b28748880e04124294b2e8802b52365266b90af6bf60de3cc4b9fc0b26dc8da6
|
File details
Details for the file mailfeed-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mailfeed-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f23a8e289da40ae0a27e89aac81927253b2b3f505e7008339f8713f4556b00c
|
|
| MD5 |
0d7c0db530fc01e18e3d2e27ee8ca14c
|
|
| BLAKE2b-256 |
b71c88dec69e4ed4425d80e373996a72cec3fea01524679695fb2f5a4146d98c
|