Skip to main content

No project description provided

Project description

DMT SMTP

This Python library provides a class, EmailSender, for sending emails using SMTP and saving sent emails via IMAP. It also includes utility classes and functions for email creation (Email), custom MIME part handling (CustomMIMEMultipart), and logging (MyLogger, setup_logger).

Features

  • SMTP Connection: Establishes secure connections to SMTP servers using TLS (both explicit and implicit).
  • IMAP Integration: Saves sent emails to the "Sent" folder via IMAP. Automatically attempts to locate the correct sent folder.
  • Email Creation: The Email class simplifies email construction, including handling recipients (To and CC), attachments, and HTML email bodies with signatures.
  • Customizable MIME: The CustomMIMEMultipart class allows for customized MIME parts, including attachments and HTML body with inline images for signatures.
  • Logging: Integrated logging with customizable format and level.
  • Error Handling: Provides SMTPResponse objects for tracking success/failure of email sending.

Class Structure

  • EmailSender: Main class for sending emails. Manages SMTP and IMAP connections.
  • Email: Represents an email message, including headers, body, attachments, and signature.
  • CustomMIMEMultipart: Custom MIME part handling for attachments and HTML body.
  • SMTPResponse: Data model for the result of an email sending operation.
  • MyLogger: Wrapper around the standard logger to customize format temporarily.

Logging

The library uses Python's built-in logging module. You can provide your own logger or use the included setup_logger function.

Error Handling

The EmailSender.send() method returns an SMTPResponse object, which contains a success flag and an error message if the email sending failed. This facilitates robust error handling.

Email Formatting

The CustomMIMEMultipart and Email classes handle the formatting of the email, including attachments, HTML bodies, and signatures. The HTML body is generated from a template and uses a <pre> tag to preserve the original layout and tabs in the email body.

IMAP Sent Folder

The library attempts to automatically find the "Sent" folder on the IMAP server by checking common folder names.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

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

dmt_smtp-0.1.17.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dmt_smtp-0.1.17-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file dmt_smtp-0.1.17.tar.gz.

File metadata

  • Download URL: dmt_smtp-0.1.17.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.5 Windows/11

File hashes

Hashes for dmt_smtp-0.1.17.tar.gz
Algorithm Hash digest
SHA256 4227c9619e851a7af7fa52325c98642825cb0839e1d2de874c732f8da44de448
MD5 93459f06c574a32a9af6808886dd19bb
BLAKE2b-256 a1ef0930de8bfa408450c1a9a3baeccef27147c37b799aef05fd06a0f6942529

See more details on using hashes here.

File details

Details for the file dmt_smtp-0.1.17-py3-none-any.whl.

File metadata

  • Download URL: dmt_smtp-0.1.17-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.5 Windows/11

File hashes

Hashes for dmt_smtp-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 0b750564a3bcd34f99c84a0c15ed34145d3fe0bee7092147c6bb7db3c16ca897
MD5 28a0a023a2e0910ad51f2f40264d6c0b
BLAKE2b-256 e970249fb46225b7173a9a48b00892c1364197d15510e888dedc8e1a8d21cece

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