Email notifications when a code block or function finishes or ends unexpectedly.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 email_notify-1.1.0.tar.gz.
File metadata
- Download URL: email_notify-1.1.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77af0055a9ddc3dbbd91243eb15e29457a7ddfc4003436ed1c2a35d9920909b3
|
|
| MD5 |
bf7f7fe4b1584f86ae39ba7ff801cd6a
|
|
| BLAKE2b-256 |
cba5cfb8e3ec9255954c2446297743b89e4140a4be5574bf69c7408765616923
|
Provenance
The following attestation bundles were made for email_notify-1.1.0.tar.gz:
Publisher:
python-publish.yml on huchaoning/email-notify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
email_notify-1.1.0.tar.gz -
Subject digest:
77af0055a9ddc3dbbd91243eb15e29457a7ddfc4003436ed1c2a35d9920909b3 - Sigstore transparency entry: 1517450100
- Sigstore integration time:
-
Permalink:
huchaoning/email-notify@664df48a8286c2ba5c4b790c7eb5ba324bb0c0ec -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/huchaoning
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@664df48a8286c2ba5c4b790c7eb5ba324bb0c0ec -
Trigger Event:
push
-
Statement type:
File details
Details for the file email_notify-1.1.0-py3-none-any.whl.
File metadata
- Download URL: email_notify-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64fe065073fd43be22b357d374a41ce6cd67ae660385554fef317ef7db92efb8
|
|
| MD5 |
22451fe806677d3917597cc081b91bcf
|
|
| BLAKE2b-256 |
fb7af262a8528825a23a59f4d45bec6888a8e2a2bdd13e997a50509f7b2e973d
|
Provenance
The following attestation bundles were made for email_notify-1.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on huchaoning/email-notify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
email_notify-1.1.0-py3-none-any.whl -
Subject digest:
64fe065073fd43be22b357d374a41ce6cd67ae660385554fef317ef7db92efb8 - Sigstore transparency entry: 1517450560
- Sigstore integration time:
-
Permalink:
huchaoning/email-notify@664df48a8286c2ba5c4b790c7eb5ba324bb0c0ec -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/huchaoning
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@664df48a8286c2ba5c4b790c7eb5ba324bb0c0ec -
Trigger Event:
push
-
Statement type: