PyMailkit
PyMailkit is a lightweight Python library designed to simplify sending and receiving emails. It provides an easy-to-use interface for interacting with email servers, making it ideal for automation, notifications, and email-based workflows.
Project Structure
- Send emails with attachments and custom headers
- Fetch and filter emails from your inbox
- Simple authentication using app passwords
- Minimal dependencies and easy setup
PyMailkit/
├── LICENSE
├── pyproject.toml
├── README.md
├── setup.py
└── src/
└── pymailkit/
├── __init__.py
├── auth.py
├── receiver.py
├── sender.py
└── tests/
├── test_receiver.py
└── test_sender.py
Installation
Install PyMailkit with pip:
pip install PyMailkit
Modules
1. Sender Module (pymailkit.sender)
The sender module allows you to send emails easily, including support for attachments and custom subjects/bodies.
Key Features:
- Send plain text or HTML emails
- Add attachments
- Specify sender, recipients, subject, and body
Example:
from pymailkit.sender import EmailSender
# Initialize the email sender
mail_server = EmailSender()
# Connect to your email account (prompts for app password)
mail_server.connect(username="example@gmail.com")
# Email details
from_add = "fromsomeone@gmail.com"
to_add = "tosomeone@gmail.com"
sub = "Sample Subject"
body = "Sample body for email sending example"
# Send the email
mail_server.send_email(
to_addresses=to_add,
from_address=from_add,
subject=sub,
body=body,
attachments = "/content/sample_data/mnist_test.csv" # Provide absolute path
)
# Close the connection to the server
mail_server.close()
2. Receiver Module (pymailkit.receiver)
The receiver module lets you fetch emails from your inbox, with options to limit the number of emails and filter by criteria.
Key Features:
- Fetch emails from inbox
- Limit number of emails retrieved
- Access email metadata (subject, sender, date, body)
Example:
from pymailkit.receiver import EmailReceiver
# Initialize the email receiver
mail_server = EmailReceiver()
# Connect to your email account (prompts for app password)
mail_server.connect(username="example@gmail.com")
# Fetch the latest 3 emails
emails = mail_server.fetch_emails(limit=3)
# Print subjects of fetched emails
for email in emails:
print(email['subject'])
# Close the connection to the server
mail_server.close()
Authors
Metadata
Release files for PyMailkit 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pymailkit-2.0.1.tar.gz | 8.1 kB | Without provenance | Details for pymailkit-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymailkit-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for pymailkit-2.0.1-py3-none-any.whl |
Total release size: 16.4 kB
Release files / pymailkit-2.0.1.tar.gz
| Download URL | pymailkit-2.0.1.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e60e0b0b8211dc06a033f602c61754801e18fce4628ff44050299045f9bf47b
|
|
BLAKE2b-256 checksum How to use checksums |
b68c7d5e6d7ce76dc8c5d988a8b436048b1ced7501d716651d31e7443ea5d0bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0rc1
|
Release files / pymailkit-2.0.1-py3-none-any.whl
| Download URL | pymailkit-2.0.1-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2cac1f858c75e1b16a17c9e765893f3a8c6bc7b5b45589e5016230bce29dd685
|
|
BLAKE2b-256 checksum How to use checksums |
777d82a31026bd3b4f1ab118ffca5ff3181f4100aa4d0552532f962813cff1bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0rc1
|
Security for PyMailkit 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.