dbbasic-email
Simple email queue with Unix mail support.
"Email is Unix mail. Queuing is sendmail. Templates are heredocs."
Features
- Local Mail: Unix-style mailboxes for internal notifications (instant delivery)
- External Email: SMTP delivery via dbbasic-queue (async, retry logic)
- Simple Templates: Plain text templates with string formatting
- Zero Config: Works with localhost SMTP out of the box
- Minimal: ~200 lines, stdlib only (queue optional)
Installation
pip install dbbasic-email
For external email (SMTP queue):
pip install dbbasic-email[queue]
Quick Start
Local Mail (Internal Notifications)
from dbbasic_email import mail
# Send to user on same app
mail('john', 'New comment', 'Jane commented on your post')
# → Appends to var/mail/john (instant)
# Read mailbox
from dbbasic_email import read_mail
messages = read_mail('john', limit=20)
for msg in messages:
print(f"{msg['subject']}: {msg['body']}")
External Email (SMTP)
from dbbasic_email import send_email
# Queue for delivery
job_id = send_email(
to='user@gmail.com',
subject='Welcome!',
body='Thanks for signing up'
)
# Returns immediately (queued)
Templates
from dbbasic_email import send_template
# templates/email/welcome.txt
send_template('user@gmail.com', 'welcome', {
'username': 'john',
'app_url': 'https://myapp.com'
})
Configuration
Set environment variables for SMTP:
export SMTP_HOST=smtp.gmail.com
export SMTP_PORT=587
export SMTP_USER=your@gmail.com
export SMTP_PASSWORD=your-app-password
export FROM_ADDR=noreply@myapp.com
For local development:
python -m smtpd -n -c DebuggingServer localhost:1025
export SMTP_HOST=localhost SMTP_PORT=1025
CLI Commands
# Send local mail
dbbasic email:local john "Test" "Hello from CLI"
# View inbox
dbbasic email:inbox john
# Send external email (queued)
dbbasic email:send user@example.com "Hello" "Test"
# View queue status
dbbasic email:queue
# Run worker (process SMTP queue)
dbbasic email:worker
How It Works
Local Mail (Unix-style)
mail('john', subject, body)
↓
Append to var/mail/john (mbox format)
↓
Instant delivery
External Email (SMTP)
send_email(to, subject, body)
↓
Queue via dbbasic-queue
↓
Worker picks up
↓
Send via SMTP (with retries)
Philosophy
Email is not a cloud service. Unix had local mail working in 1971. The web made it complicated. Let's return to simplicity.
- Unix Mail First: Local delivery to var/mail/{user}
- SMTP When Needed: External email via SMTP (like sendmail)
- Queue Integration: Uses dbbasic-queue for async delivery
- Plain Text First: Templates are just string formatting
- No Service Required: Works without external email service
Full Documentation
See the specification for complete details.
License
MIT
Metadata
Release files for dbbasic-email 1.0.0
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 |
|---|---|---|---|---|
| dbbasic_email-1.0.0.tar.gz | 6.4 kB | Without provenance | Details for dbbasic_email-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dbbasic_email-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for dbbasic_email-1.0.0-py3-none-any.whl |
Total release size: 13.2 kB
Release files / dbbasic_email-1.0.0.tar.gz
| Download URL | dbbasic_email-1.0.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
841e714b57527fe5d176691f304ae471b8481935ffbf5de6eb9ecaed87564568
|
|
BLAKE2b-256 checksum How to use checksums |
3699190520de20670f95d5514bd86ae2b9e3aa4c388a5a72d31f5a8bc0b11211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.1
|
Release files / dbbasic_email-1.0.0-py3-none-any.whl
| Download URL | dbbasic_email-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bccaff699e79786086985a369655e484d69c72ea107ed6b6c53c9e0b592d9258
|
|
BLAKE2b-256 checksum How to use checksums |
efa37ee312a67c183956c8381d2c708a77cbdf71e82886b4e7519640bbebee1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.1
|
Security for dbbasic-email 1.0.0
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.