email-to

0.1.0 · abandoned · verified Wed Apr 15

The 'email-to' library simplifies sending HTML emails in Python by providing a higher-level API over the built-in `smtplib` and `email.mime` modules. Its current version is 0.1.0. The library appears to be unmaintained with no releases since 2017, making its release cadence effectively dormant.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize an `EmailServer` and send a basic HTML email using `quick_email`. It's crucial to use environment variables for sensitive SMTP credentials rather than hardcoding them.

import email_to
import os

# It's recommended to use environment variables for sensitive credentials
SMTP_HOST = os.environ.get('EMAIL_SMTP_HOST', 'smtp.example.com')
SMTP_PORT = int(os.environ.get('EMAIL_SMTP_PORT', 587))
SMTP_USERNAME = os.environ.get('EMAIL_USERNAME', 'your_email@example.com')
SMTP_PASSWORD = os.environ.get('EMAIL_PASSWORD', 'your_app_password')

RECIPIENT_EMAIL = os.environ.get('EMAIL_RECIPIENT', 'recipient@example.com')

try:
    # Initialize the EmailServer
    server = email_to.EmailServer(
        SMTP_HOST, 
        SMTP_PORT, 
        SMTP_USERNAME, 
        SMTP_PASSWORD
    )

    # Send a quick HTML email
    server.quick_email(
        RECIPIENT_EMAIL,
        'Test Subject from email-to',
        ['<h1>Hello from email-to!</h1>', '<p>This is a test HTML email.</p>'],
        style='h1 { color: blue; } p { font-family: sans-serif; }'
    )
    print("Email sent successfully!")
except Exception as e:
    print(f"Failed to send email: {e}")

view raw JSON →