Skip to main content

Emailed Before

A simple Python library for keeping track when emails about some topics were sent.

Installation

You can install the library from PyPI.

pip install emailed-before

Usage

First construct a SentEmails instance:

from emailedbefore import SentEmails

sent_emails = SentEmails(sqlite_file)

sqlite_file is the path to a Sqlite3 file. It will be created if it doesn't exist yet.

You can then register the fact that an email has been sent.

email = "someone@example.com"
topic = "Your library books are due"
sent_emails.register(email, topic)

To find out when emails about a topic were sent you can use the sent_at method, which returns a list of datetimes. The list is ordered.

from datetime import datetime, timedelta

# Remind the user about those books again after a week.
datetimes = sent_emails.sent_at(email, topic)
if len(datetimes) and datetime.now() - datetimes[-1] > timedelta(days=7):
    ... # email the user

For convenience, there is also a method last_sent_at which returns the datetime when the last email was sent (or None if no email has been sent). So the previous code example can be rewritten as:

from datetime import datetime, timedelta

# Remind the user about those books again after a week.
last_sent = sent_emails.last_sent_at(email, topic)
if last_sent and datetime.now() - last_sent > timedelta(days=7):
    ... # email the user

Metadata

Release files for emailed-before 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emailed-before 0.2.0
File Size Uploaded Provenance Actions
emailed-before-0.2.0.tar.gz 3.1 kB Without provenance Details for emailed-before-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for emailed-before 0.2.0
File Interpreter ABI Platform Actions
emailed_before-0.2.0-py3-none-any.whl Python 3 none any Details for emailed_before-0.2.0-py3-none-any.whl

Total release size: 7.2 kB

Release files / emailed-before-0.2.0.tar.gz

Download URL emailed-before-0.2.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fed752f9bc93d67774227eb1f778c16f14fca205bf14b5c034304262393e6dbe
BLAKE2b-256 checksum
How to use checksums
c6779a302180f406821ecaced2e699ce01bf8c4149f832c42972139efe755e1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.8.6

Release files / emailed_before-0.2.0-py3-none-any.whl

Download URL emailed_before-0.2.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4afde2810df1124fc6eec3c3b402f938e3202f946e36300a8729a90f58af49df
BLAKE2b-256 checksum
How to use checksums
43da3d9929cf8cf7f889b6a6a8382eab40f366168f9c8b5775661bfcdbc3f60f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.8.6

Security for emailed-before 0.2.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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page