A Simple SMTP Email Sender with the support of sync or async sending. Powered by PyO3
Project description
simple_smtp_sender
A Simple SMTP Email Sender with the support of sync or async sending. Powered by powered by Rust, lettre and PyO3.
Overview
This project provides a Python extension module implemented in Rust for sending emails via SMTP, including support for attachments, CC, and BCC. There are methods for both synchronous and asynchronous sending. It leverages the performance and safety of Rust, exposes a convenient Python API, and is built using PyO3 and lettre. The module is compatible with Python 3.10 and above.
Features
- Send emails via SMTP synchronously or asynchronously from Python
- Support HTML email contents
- Attach files to emails
- Support for CC and BCC
- Secure authentication
- Easy configuration via Python class
Installation
from PyPI
pip install simple_smtp_sender
from source (requires Rust toolchain and maturin)
git clone https://github.com/guangyu-he/simple_smtp_sender.git
cd simple_smtp_sender
# prepare venv and maturin if needed
maturin build
Requirements
- Python >= 3.10
- Rust toolchain (for building)
Usage
from simple_smtp_sender import EmailConfig, send_email, async_send_email
config = EmailConfig(
server="smtp.example.com",
sender_email="your@email.com",
username="your_username",
password="your_password",
)
# Synchronous send (blocking)
send_email(
config,
recipient=["recipient@email.com"],
subject="Test Email",
body="Hello from Rust!",
)
# With attachment, CC, and BCC:
send_email(
config,
recipient=["recipient@email.com"],
subject="With Attachment",
body="See attached file.",
cc=["cc@email.com"],
bcc=["bcc@email.com"],
attachment="/path/to/file.pdf",
)
# Asynchronous send (non-blocking)
import asyncio
async def main():
await async_send_email(
config,
recipient=["recipient@email.com"],
subject="Async Email",
body="Sent asynchronously!",
)
asyncio.run(main())
API
EmailConfig
Configuration class for SMTP server and credentials.
server: SMTP server URLsender_email: Sender's email addressusername: SMTP usernamepassword: SMTP password
send_email(config, recipient, subject, body, cc=None, bcc=None, attachment=None)
Sends an email synchronously (blocking) using the provided configuration.
config:EmailConfiginstancerecipient: List of recipient email(s)subject: Email subjectbody: Email bodycc: List of CC recipients (optional)bcc: List of BCC recipients (optional)attachment: Path to file to attach (optional)
async_send_email(config, recipient, subject, body, cc=None, bcc=None, attachment=None)
Sends an email asynchronously (non-blocking, returns an awaitable).
config:EmailConfiginstancerecipient: List of recipient email(s)subject: Email subjectbody: Email bodycc: List of CC recipients (optional)bcc: List of BCC recipients (optional)attachment: Path to file to attach (optional)
Development
- Rust dependencies are managed in
Cargo.toml. - Python build configuration is in
pyproject.toml. - Main Rust logic in
src/.
License
MIT
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
Built Distributions
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 simple_smtp_sender-0.2.0.tar.gz.
File metadata
- Download URL: simple_smtp_sender-0.2.0.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
586dcb18586b05eb0d74f3bc85b7d31c0d93edfbe92e7ab4fde2a80e2628ecc2
|
|
| MD5 |
9efe2da0347587dd26ede1204238ce58
|
|
| BLAKE2b-256 |
145650840376761fd08a26e29a0c169fd3ecf00ee979c27962311b23aed763ee
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 715.9 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f17d888ecc3bf1e59f8424e9cfe4a92991ed72ba9585ba91a493d52c1a336905
|
|
| MD5 |
8d09987f1643f523f4f5a8ac6c7d359e
|
|
| BLAKE2b-256 |
b815623812b769f90b920515465fc32e299b2b6c054376c4c782f5dbcf91a9e8
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-win32.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-win32.whl
- Upload date:
- Size: 671.5 kB
- Tags: CPython 3.10+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a9d605d2316f451f38c6a4b0fb7ed59e6cc9adf60b19df6b266ce29c2c774d7
|
|
| MD5 |
118ec298dc382f5cac817338fab93260
|
|
| BLAKE2b-256 |
24d3743051b5178e5036c2da0063e69d5135c0befb9446f644efac5980c80e19
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e2634d4281d49e0c1e90e3fbdf4acb351a5e34d067fc4e6d3545e1720f0274
|
|
| MD5 |
b33be4b4cb5d3dc403f7e25a2ad5420f
|
|
| BLAKE2b-256 |
4bf8f2e11ce4fcb519798dac6eb9803d089d713da2af32ac33eb8f8a078c1550
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-musllinux_1_2_i686.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-musllinux_1_2_i686.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0f309c5da3ea3ecf80b29ce6b01c84fe2c274270195f036d90a9bd0f34ea52f
|
|
| MD5 |
599e20bf46eddbb13fb5e29140dfb169
|
|
| BLAKE2b-256 |
003b8e6e9657bac142afb4df8b9a97e22606da25110da0301a36b7847decc7cd
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-musllinux_1_2_armv7l.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e48454e4af2cf010ca1ed8d80332923518f2b1cad804ee2e269f0f795d3cba52
|
|
| MD5 |
3e0a9c067fda1d3ac7ab155801d3b99e
|
|
| BLAKE2b-256 |
54ae9c1877ba43ad92f9693df69d24ceb1d2ce4aae8083cbe2ae618f5690c5b3
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef042dbcd237ab669248bcda22fe7f8c5c795d970d96601658b728cf2547b0ce
|
|
| MD5 |
763ad19e1157b856857932ea16f01a92
|
|
| BLAKE2b-256 |
05511bee58286c91d5913379eaa1fe8b15d3091883e8ad5857bfd3a738fd1a43
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c88ea379176c8c9f570d7203967cd6c42d7419c8fd6bd0b92cb65bda8c9ab218
|
|
| MD5 |
fe495dc5fc4cd5c06e6ae13d321a1d2e
|
|
| BLAKE2b-256 |
d6d1dc8aa96c6d595a29c5f5b06d4dbea5314fbc344500205a964ba7d9958da7
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad42032c3a585acda6e6f35be519c267d56a2f5e70949362963625ccc74f92d7
|
|
| MD5 |
a69a2348202c882df559340459be20cd
|
|
| BLAKE2b-256 |
98d5862545530df27e61891bc2eba18b8dca774c591b3cef212058ced7734040
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2f5c189941965810be84d884780cf64b34cb66815d1196bf37accd71709bf02
|
|
| MD5 |
3a56cdbcda1bde1f17a2120193a82a25
|
|
| BLAKE2b-256 |
b266674cdd0190b98c13b07dc1bdb9e896643773fe089e8d3e886c46e2e1a3db
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c517deb1acd7949a3ff01f6fe02db51700e4eaade1c0ceda551b87ed5dd54b99
|
|
| MD5 |
188862da6acef38b9fe534001627f7d5
|
|
| BLAKE2b-256 |
e1202eca0d959d00d0e86823ab87f2236e4d0d1f48052399397aee34a61028b6
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 850.9 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e12dec03c9cd47a09facb0e9d51d560a7ca81e4257fe72b765cf93d36b38143
|
|
| MD5 |
d44fce55991df0e1faed3dd2e8e02e00
|
|
| BLAKE2b-256 |
08cf93f89c3dae70e6e7bd36c4e75f831c3ad730356e97ce82eae78b2dfd6cba
|
File details
Details for the file simple_smtp_sender-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: simple_smtp_sender-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 867.2 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26fae2a4f6c93ce808293c4e00942c2d9caf38ad90142e71965f80cd88b06abb
|
|
| MD5 |
c70ca731f914c8fc35e5e5776ec70a7f
|
|
| BLAKE2b-256 |
8ed99029ae5ae8e89c9281eda84c3599fa96eb7ddb4fabe345c8abc7c1239835
|