A Python package for retrieving, parsing, and sending emails
Project description
mailsuite
A Python package for retrieving, parsing, and sending emails.
Features
- Simplified IMAP client
- Retrieve email from any folder
- Create new folders
- Move messages to other folders
- Delete messages
- Monitor folders for new messages using the IMAP
IDLEcommand - Always use
/as the folder hierarchy separator, and convert to the server's hierarchy separator in the background - Always remove folder name characters that conflict with the server's hierarchy separators
- Prepend the namespace to the folder path when required
- Automatically reconnect when needed
- Work around quirks in Gmail, Microsoft 365, Exchange, Dovecot, and DavMail
- Consistent email parsing
- SHA256 hashes of attachments
- Parsed
Authentication-ResultsandDKIM-Signatureheaders - Parse Microsoft Outlook
.msgfiles usingmsgconvert
- Simplified email creation and sending
- Easily add attachments, plain text, and HTML
- Uses opportunistic encryption (
STARTTLS) with SMTP by default
- DKIM signing and verification
- Generate RSA keypairs and the matching DNS TXT record
- Sign outbound mail with a sensible default header set (with
From,To,Cc,Subjectoversigned) - Verify one or many
DKIM-Signatureheaders on a received message
- Provider-agnostic mailbox abstraction (
mailsuite.mailbox)- Single
MailboxConnectioninterface for IMAP, Microsoft Graph, Gmail, and on-disk Maildir - Unified
send_message()on backends that support sending (Microsoft Graph, Gmail) — IMAP and Maildir users send throughmailsuite.smtp.send_email
- Single
Installation
Base install (IMAP, SMTP, DKIM, Maildir, parsing):
pip install mailsuite
The Microsoft Graph and Gmail backends are optional extras — the cloud SDKs aren't pulled in unless you ask for them:
pip install "mailsuite[msgraph]" # Microsoft Graph (msgraph-sdk + azure-identity)
pip install "mailsuite[gmail]" # Gmail (google-api-python-client + google-auth-oauthlib)
pip install "mailsuite[all]" # both
Importing mailsuite.mailbox never requires the extras. Referencing
MSGraphConnection or GmailConnection without the matching extra
installed raises an ImportError pointing at the right install command.
Microsoft Graph notes
MSGraphConnection defaults to the worldwide cloud
(https://graph.microsoft.com). To target a sovereign cloud or any
other Graph endpoint, pass graph_url:
MSGraphConnection(..., graph_url="https://graph.microsoft.us")
The azure-identity token cache lives under name="mailsuite" by
default. Applications migrating from a previous installation that used a
different cache name can pass it through token_cache_name= so existing
cached AuthenticationRecords and tokens continue to work — for
example, token_cache_name="parsedmarc" keeps users authenticated
across the migration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mailsuite-2.0.0.tar.gz.
File metadata
- Download URL: mailsuite-2.0.0.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.12.3 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8becbd57831c301d4b89ec7e797d180e1bb6a32a46b3822e493e6cd82d0465b9
|
|
| MD5 |
51e3afdc44a1d3c6eadbd0f1a23272fb
|
|
| BLAKE2b-256 |
ba26df8f20f3aadd74ee2e006ee5f2bb8b4c65a4c126172a2839a8ecdf2c81c8
|
File details
Details for the file mailsuite-2.0.0-py3-none-any.whl.
File metadata
- Download URL: mailsuite-2.0.0-py3-none-any.whl
- Upload date:
- Size: 36.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.12.3 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9637a96caffc59f630d18edddab3a43da374604e23236ca6d62afb445127785
|
|
| MD5 |
62f386a2bffad5a82f9a596bc2d2bd8f
|
|
| BLAKE2b-256 |
a916863592b0e2dc43c519abe96c5c442b6c6dc9f6c4fb34d4672e489fd0302f
|