Skip to main content

Reusable library for sending HTML emails with images and attachments

Project description

Mailfeed Logo

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.1.tar.gz (7.2 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.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

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

Hashes for mailfeed-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6a028364d408f694dd47182cbd779f29284eab75202301ae8e1ab0bfb472e152
MD5 e1b8a01916ad0f4f811d0a8f2b2dd79c
BLAKE2b-256 494ff162c971ac5924b9118cc9687ac3f9916768c1f9f6e26e610550590b81c3

See more details on using hashes here.

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

Hashes for mailfeed-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 117b324cc13c6b7e4c37f37581aaf4a2536a160b1177e2571a0c814d028744c0
MD5 6f1e94f3077d25bfb64ef90fed8a8447
BLAKE2b-256 8bf3d1f81f22e86eec84bf221e272010ec64b9e86d41f1ddcb00fc3fb8327b97

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