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.1.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.1.tar.gz.
File metadata
- Download URL: mailfeed-0.1.1.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 |
6a028364d408f694dd47182cbd779f29284eab75202301ae8e1ab0bfb472e152
|
|
| MD5 |
e1b8a01916ad0f4f811d0a8f2b2dd79c
|
|
| BLAKE2b-256 |
494ff162c971ac5924b9118cc9687ac3f9916768c1f9f6e26e610550590b81c3
|
File details
Details for the file mailfeed-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mailfeed-0.1.1-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 |
117b324cc13c6b7e4c37f37581aaf4a2536a160b1177e2571a0c814d028744c0
|
|
| MD5 |
6f1e94f3077d25bfb64ef90fed8a8447
|
|
| BLAKE2b-256 |
8bf3d1f81f22e86eec84bf221e272010ec64b9e86d41f1ddcb00fc3fb8327b97
|