MailToolsBox – Powerful Email Automation for Python

MailToolsBox

MailToolsBox is a comprehensive Python library designed to simplify email handling, making it easy to send, manage, and automate email workflows. Whether you need to send emails with attachments, use HTML templates, or securely authenticate with SMTP, MailToolsBox is the perfect solution.

šŸš€ Key Features

āœ… EmailSender Class (New & Improved)

  • Send emails via SMTPĀ with support forĀ CC, BCC, and multiple recipients.
  • TLS/SSL encryptionĀ forĀ secureĀ email transmission.
  • HTML & Plain Text SupportĀ for rich email formatting.
  • Attachment HandlingĀ to send multiple files effortlessly.
  • Jinja2 Template SupportĀ forĀ dynamic, personalized emails.

šŸ— Template-Based Emails with Jinja2

  • Create and sendĀ HTML emails using templates.
  • Autoescapes content forĀ safe rendering.
  • Makes emailsĀ more dynamic and customizable.

šŸ” Secure & Reliable

  • UsesĀ email-validatorĀ to ensureĀ valid recipient emails.
  • SupportsĀ TLS encryptionĀ for better security.
  • Built-in error loggingĀ to handle SMTP issues.

šŸ”„ Backward Compatibility with SendAgent

  • OlderĀ SendAgentĀ implementationsĀ still work.
  • EncouragesĀ migration toĀ EmailSenderĀ for better performance.

šŸ“„ Installation

You can install or upgrade MailToolsBox via PyPI:

pip install --upgrade MailToolsBox

šŸš€ Quick Start – Sending an Email

With MailToolsBox, sending emails is incredibly easy.

from MailToolsBox import EmailSender

# Email configuration
sender = EmailSender(
    user_email="your@email.com",
    server_smtp_address="smtp.example.com",
    user_email_password="yourpassword",
    port=587
)

# Send an email
sender.send(
    recipients=["recipient@example.com"],
    subject="Hello from MailToolsBox",
    message_body="This is a test email."
)

šŸ“‚ Sending an HTML Email with Attachments

sender.send(
    recipients=["recipient@example.com"],
    subject="HTML Email Example",
    message_body="""<h1>Welcome!</h1><p>This is an <strong>HTML email</strong>.</p>""",

    html=True,
    attachments=["/path/to/document.pdf"]
)

šŸ— Using Email Templates (Jinja2 Support)

MailToolsBox now supports Jinja2 templates for clean and structured emails.

Example Template (templates/welcome.html):

<html>
<head>
    <title>Welcome</title>
</head>
<body>
    <h1>Welcome, {{ username }}!</h1>
    <p>Click <a href="{{ activation_link }}">here</a> to activate your account.</p>
</body>
</html>

Sending a Templated Email:

context = {
    "username": "John Doe",
    "activation_link": "https://example.com/activate"
}

sender.send_template(
    recipient="recipient@example.com",
    subject="Welcome to Our Service",
    template_name="welcome.html",
    context=context
)

šŸŒŸ Why Choose MailToolsBox?

āœ” Simple & Clean API – Designed for developers.
āœ” Security First – TLS/SSL encryption for safe email sending.
āœ” High Performance – Optimized for large email batches.
āœ” Easy to Integrate – Works with any Python project.


šŸ“Œ SEO Focus Keywords & Tags

Tags: Python, Email Automation, SMTP, Email API, Email Tools, Python Email Library, EmailSender, MailToolsBox

Focus Keywords: Python email library, MailToolsBox, SMTP email sending, Python email automation, secure email library


šŸ”— Download & Resources

šŸ“œ Official Documentationrambod.net
šŸ“¦ PyPI PackageMailToolsBox on PyPI
šŸ›  GitHub RepositoryMailToolsBox on GitHub


šŸ¤ Contribution & Community

We welcome contributions! If you’d like to improve MailToolsBox:

  1. Fork the repository on GitHub.
  2. Create a new feature branch.
  3. Implement changes and write tests.
  4. Submit aĀ pull requestĀ for review.

Let’s make MailToolsBox the best Python email automation library together! šŸš€