Skip to main content

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


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.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mailfeed-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file mailfeed-0.1.0.tar.gz.

File metadata

  • Download URL: mailfeed-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mailfeed-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d12e6c12184f77882cf3f172b9fd68f74ff02bac61bd54194a551165b0037e9
MD5 f57c3824922fb7c9459a94bd860036ea
BLAKE2b-256 a158e2e94a0721a6c20c9795f4e391f6e64f465bd0efaa1c5ca3fd5697959417

See more details on using hashes here.

File details

Details for the file mailfeed-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mailfeed-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mailfeed-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 872f9d5c88f1b66afddf405059c5b1c6ab4e60d849c73e302a9d0f3979f8fdbe
MD5 23b1f8fe8935bcf60116bc20df1c8bc0
BLAKE2b-256 5e798a423b2fb4e0f74cc30ea7e0bf066623dcf27cacef6e34c63169d50f9fc2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page