We are thrilled to announce the release of MailToolsBox 1.0.0, a major update that brings enhanced email handling, improved security, better error management, and much more!

🎉 What’s New in MailToolsBox 1.0.0?

This version is a complete revamp of the library, making it more efficient, secure, and developer-friendly. Below are the key updates:

1. Redesigned EmailSender Class

📂 2. Attachment Handling

🏗 3. Jinja2-Based Email Templates

🛡 4. Improved Security & Email Validation

🔧 5. Better Error Handling & Logging

🔄 6. Backward Compatibility with SendAgent


📥 Installation

You can install or upgrade to the latest version of MailToolsBox using pip:

pip install --upgrade MailToolsBox

🚀 How to Use MailToolsBox 1.0.0

1. Sending a Basic Email

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
)

# Sending email
sender.send(
    recipients=["recipient@example.com"],
    subject="Test Email",
    message_body="Hello, this is a test email!"
)

2. 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"]
)

3. Using Jinja2 Templates for Emails

MailToolsBox now supports Jinja2 templates for easy email customization.

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 an Email with a Template:

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
)

4. Sending Emails with CC & BCC

sender.send(
    recipients=["recipient@example.com"],
    subject="CC & BCC Example",
    message_body="This email has CC and BCC recipients!",
    cc=["cc@example.com"],
    bcc=["bcc@example.com"]
)

5. Backward Compatibility with SendAgent

For users migrating from older versions, SendAgent still works:

from MailToolsBox import SendAgent

legacy_sender = SendAgent(
    user_email="your@email.com",
    server_smtp_address="smtp.example.com",
    user_email_password="yourpassword",
    port=587
)

legacy_sender.send_mail(
    recipient_email=["recipient@example.com"],
    subject="Legacy Compatibility Test",
    message_body="Testing backward compatibility."
)

🔐 Best Practices for Security

Example using environment variables:

import os

sender = EmailSender(
    user_email=os.getenv("EMAIL"),
    server_smtp_address=os.getenv("SMTP_SERVER"),
    user_email_password=os.getenv("EMAIL_PASSWORD"),
    port=int(os.getenv("SMTP_PORT", 587))
)

🔥 Conclusion

The 1.0.0 release of MailToolsBox is a significant upgrade, making email handling more secure, efficient, and flexible. With modern API improvements, enhanced logging, better security, and backward compatibility, it’s the best version yet!

🌍 Learn More & Stay Updated

🔹 If you have any questions, feel free to contribute, report issues, or suggest improvements! 🚀


🛠 How to Contribute

MailToolsBox is an open-source project. Contributions are always welcome!

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

Thank you for your support! 🎉

📢 Don’t forget to update to MailToolsBox 1.0.0 today!

Leave a Reply

Your email address will not be published. Required fields are marked *

ten + 9 =