
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
A Simple SMTP Email sender crate with the support of sync or async sending. Can be called from Python. Powered by PyO3.
A Simple SMTP Email sender crate with the support of sync or async sending. Can be called from Python. Powered by powered by Rust, lettre and PyO3.
This project provides rust crate and 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 python module is compatible with Python 3.10 and above.
uv pip install simple_smtp_sender
# or
pip install simple_smtp_sender
Add to your Cargo.toml
:
[dependencies]
# Default: includes Python bindings (requires Python environment)
simple_smtp_sender = "0.2.3"
# Rust-only version (no Python dependencies)
simple_smtp_sender = { version = "0.2.3", default-features = false, features = ["rslib"] }
git clone https://github.com/guangyu-he/simple_smtp_sender.git
cd simple_smtp_sender
# prepare venv and maturin if needed
maturin develop
Or build a wheel:
maturin build
pip install target/wheels/simple_smtp_sender-*.whl
An example test from Rust crate:
use simple_smtp_sender::{send_email_async, send_email_sync, EmailConfig};
#[test]
fn send_email_sync_test() {
let config = EmailConfig::new(
"smtp.example.com",
"your@email.com",
"your_username",
"your_password",
);
let result = send_email_sync(config, vec!["recipient@email.com"], "Test Email", "Hello from Rust!", None, None, None);
assert!(result.is_ok());
}
#[tokio::test]
fn send_email_async_test() {
let config = EmailConfig::new(
"smtp.example.com",
"your@email.com",
"your_username",
"your_password",
);
let result = send_email_async(config, vec!["recipient@email.com"], "Test Email", "Hello from Rust!", None, None, None).await;
assert!(result.is_ok());
}
An example from Python API:
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())
EmailConfig
Configuration class for SMTP server and credentials.
server
: SMTP server URLsender_email
: Sender's email addressusername
: SMTP usernamepassword
: SMTP passwordsend_email(config, recipient, subject, body, cc=None, bcc=None, attachment=None)
Sends an email synchronously (blocking) using the provided configuration.
config
: EmailConfig
instancerecipient
: 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
: EmailConfig
instancerecipient
: 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)Cargo.toml
.pyproject.toml
.src/
.MIT
FAQs
A Simple SMTP Email sender crate with the support of sync or async sending. Can be called from Python. Powered by PyO3.
We found that simple-smtp-sender demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.