https://github.com/posit-dev/nbmail
A guide for sending beautiful emails in Python
https://github.com/posit-dev/nbmail
Last synced: about 2 months ago
JSON representation
A guide for sending beautiful emails in Python
- Host: GitHub
- URL: https://github.com/posit-dev/nbmail
- Owner: posit-dev
- Created: 2025-10-06T20:59:58.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-11-14T22:06:40.000Z (5 months ago)
- Last Synced: 2025-12-25T16:17:59.890Z (3 months ago)
- Language: Python
- Homepage: https://posit-dev.github.io/email-for-data-science/
- Size: 5.02 MB
- Stars: 12
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nbmail
[](https://posit-dev.github.io/email-for-data-science/reference/)
> ⚠️ **nbmail is currently in development, expect breaking changes.**
### What is [nbmail](https://posit-dev.github.io/email-for-data-science/reference/)?
**nbmail** is a Python package for serializing, previewing, and sending email messages in a consistent, simple structure. It provides utilities to convert emails from different sources (Redmail, Yagmail, MJML, Quarto JSON) into a unified intermediate format, and send them via multiple backends (Gmail, SMTP, Mailgun, etc.).
The package is designed for data science workflows and Quarto projects, making it easy to generate, preview, and deliver rich email content programmatically.
## Example Usage
```python
from nbmail import (
quarto_json_to_email,
Email,
send_email_with_gmail,
)
# Read a Quarto email JSON file
email = quarto_json_to_email("email.json")
# Preview the email as HTML
email.write_preview_email("preview.html")
# Send the email via Gmail
send_email_with_gmail("your_email@gmail.com", "your_password", email)
```
## Features
- **Unified email structure** for serialization and conversion
- **Convert** emails from Redmail, Yagmail, MJML, and Quarto JSON
- **Send** emails via Gmail, SMTP, Mailgun, and more
- **Preview** emails as HTML files
- **Support for attachments** (inline and external)
- **Simple API** for integration in data science and reporting workflows
## Contributing
If you encounter a bug, have usage questions, or want to share ideas to make this package better, please feel free to file an [issue](https://github.com/posit-dev/email-for-data-science/issues).
For more information, see the [docs](https://posit-dev.github.io/email-for-data-science/reference) or [open an issue](https://github.com/posit-dev/email-for-data-science/issues) with questions or suggestions!