Email Notify
Email notifications when a code block or function finishes or ends unexpectedly.
Use SMTP service.
Configuration
Before using, you need to configure your email account and SMTP server.
import email_notify
# Set email address and application password (will be encrypted and saved if save=True)
email_notify.auth(save=True)
# Set SMTP server host and port (will be saved if save=True)
email_notify.smtp(save=True)
Configuration is saved in $HOME/.email_notify.config. Call forget() to remove the saved configuration.
Usage
You can use email_notify in three ways:
- As a context manager (recommended)
- As a decorator
- Calling
email_notify.send(subject, message, recipient)directly
Context Manager (recommended)
import email_notify
recipient = 'user@example.com'
with email_notify.context(recipient, task_name='Task'):
print('Running some tasks...')
# some tasks
Decorator
import email_notify
recipient = 'user@example.com'
@email_notify.decorator(recipient)
def my_task():
print('Running some tasks...')
# some tasks
my_task()
Direct Send
import email_notify
recipient = 'user@example.com'
try:
print('Running some tasks...')
# some tasks
except Exception as e:
subject = 'Task Failed'
message = f'The task failed with error:\n{e}'
email_notify.send(subject, message, recipient)
else:
subject = 'Task Completed'
message = f'The task finished successfully.\nResult: {result}'
email_notify.send(subject, message, recipient)
Installation
pip install email_notify
Requirements
- cryptography
Note
Make sure you know your SMTP service host and port before configuring.
Known SMTP service hosts and ports (updated 2025-6-8):
| Provider | SMTP Host | SMTP Port |
|---|---|---|
| QQ Mail | smtp.qq.com | 465 or 587 |
For other providers, please refer to your email service documentation or contact your administrator.
Metadata
Release files for email-notify 1.1.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 | |
|---|---|---|---|
| email_notify-1.1.0.tar.gz | 8.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| email_notify-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.4 kB
Release files / email_notify-1.1.0.tar.gz
| Download URL | email_notify-1.1.0.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77af0055a9ddc3dbbd91243eb15e29457a7ddfc4003436ed1c2a35d9920909b3
|
|
BLAKE2b-256 checksum How to use checksums |
cba5cfb8e3ec9255954c2446297743b89e4140a4be5574bf69c7408765616923
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 12, 2026.
Transparency logRelease files / email_notify-1.1.0-py3-none-any.whl
| Download URL | email_notify-1.1.0-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64fe065073fd43be22b357d374a41ce6cd67ae660385554fef317ef7db92efb8
|
|
BLAKE2b-256 checksum How to use checksums |
fb7af262a8528825a23a59f4d45bec6888a8e2a2bdd13e997a50509f7b2e973d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 12, 2026.
Transparency log