Skip to main content

Simple library to write python emails

Project description

Emailer Module

Overview

The Emailer module is a configurable Python class that handles email functionalities across an application. It provides robust features for sending emails with HTML templates, attachments, and scheduling, as well as reading emails with advanced filtering capabilities.

Features

  • Send emails with HTML templates
  • Dynamic HTML template rendering
  • Attachment support
  • CC and BCC email support
  • Email validation
  • Email scheduling
  • Email reading with filtering
  • IMAP and SMTP support

Installation

Dependencies

  • Python 3.7+
  • Required libraries:
    • Pillow (PIL)
    • beautifulsoup4

Install dependencies using pip:

pip install Pillow beautifulsoup4

Usage

Initializing the Mailer

from emailfly import Emailer

mailer = Emailer(
    sender_email="your_email@example.com",
    password="your_password",
    sender_name="Your Name",
    port=587,
    smtp_server="smtp.gmail.com"
)

Sending an Email

result = mailer.send_email(
    subject="Welcome",
    html_template="app/templates/welcome",
    recipients=["recipient@example.com"],
    data={"name": "John Doe"},
    cc_email=["cc@example.com"],
    bcc_email=["bcc@example.com"]
)

Scheduling an Email

result = mailer.schedule_email(
    subject="Delayed Notification",
    html_template="app/templates/notification",
    recipients=["recipient@example.com"],
    delay_seconds=3600  # Send after 1 hour
)

Reading Emails

emails = mailer.read_emails(
    username="your_email@example.com",
    password="your_password",
    folder="INBOX",
    limit=5,
    filter_criteria={
        "from": "sender@example.com",
        "subject": "Important"
    },
    mark_as_read=True
)

Important Notes

  • Use app-specific passwords for Gmail
  • Ensure HTML templates are properly formatted
  • Handle exceptions when sending or reading emails

Security

  • Never hardcode sensitive information like passwords
  • Use environment variables or secure credential management

Limitations

  • Requires internet connectivity
  • Email sending/reading depends on SMTP/IMAP server availability

Contributing

Contributions are welcome! Please submit pull requests or open issues on the project repository.

License

[Add your project's license information]

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

emailfly-1.0.1.tar.gz (6.5 kB view details)

Uploaded Source

File details

Details for the file emailfly-1.0.1.tar.gz.

File metadata

  • Download URL: emailfly-1.0.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for emailfly-1.0.1.tar.gz
Algorithm Hash digest
SHA256 bcc7d746bfdc9576b297e6af7733b6124bee968a14d8f9b2a358b3838b1e9262
MD5 9bc51835d6c6e930a31d2ed95fec0ed6
BLAKE2b-256 614e2ab7f9579a07e4b699430637b6217e3d04cd3b7efa8d2f11def1c4a49a2d

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