+
Skip to content

Version 3.9.1

Compare
Choose a tag to compare
@tarsil tarsil released this 18 Sep 21:37
· 33 commits to main since this release
8b98409

Added

  • is_json and is_form properties for Request.
  • Introduced esmerald.contrib.mail providing a full-featured, async-first email framework.
  • Includes a high-level Mailer API for sending single, multiple, and templated messages.
  • Supports multipart messages (text + HTML), custom headers, attachments (in-memory or files), and metadata.
  • CLI integration, esmerald mail sendtest, for sending quick test emails via console backend.
  • send_file to contrib.
  • jsonify to contrib.

Built-in Backends

These backends are shared with Lilya as they are internally used.

  • SMTPBackend: Async-friendly with connection pooling and TLS/authentication.
  • ConsoleBackend: Writes messages to stdout for debugging.
  • FileBackend: Saves emails as .eml files for inspection or archiving.
  • InMemoryBackend: Stores emails in memory for development or testing scenarios.

Application Integration

  • New setup_mail(app, backend, template_dir, attach_lifecycle=True) utility attaches a Mailer to app.state.mailer.
  • Automatically opens/closes backend connections via startup/shutdown hooks.

Exception Hierarchy

  • MailError: Base exception for all mail errors.
  • BackendNotConfigured: Raised when no backend or template renderer is configured.
  • InvalidMessage: Raised when an EmailMessage is incomplete or malformed.

Changed

  • Simplify has_permission function calls from the internals.
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载