Skip to main content

Red Box: Advanced Email Box Reader

Next generation email box reader/manager


Pypi version build codecov Documentation Status PyPI pyversions

What is it?

Red Box is an advanced email box reader library. It is a sister library for Red Mail, advanced email sender. It makes managing your email box in Python very easy.

Core features:

  • Easy email searching
  • Intuitive message manipulation
  • Intuitive email box manipulation

Install it from PyPI:

pip install redbox

Why Red Box?

Imaplib from standard library is complex to use and unintuitive. Red Box makes reading email boxes easy.

With Red Box, it is simple as this:

from redbox import EmailBox

# Create an email box instance
box = EmailBox(host="localhost", port=0)

# Select an email folder
inbox = box['INBOX']

# Get emails
emails = inbox.search(
    from_="mikael.koli@example.com",
    subject="Red Box released",
    unseen=True
)

More Examples

There is also a query language for arbitrary search queries:

from redbox.query import FROM, UNSEEN, FLAGGED

emails = inbox.search(
    FROM('mikael.koli@example.com') & (UNSEEN | FLAGGED)
)

Red Box also makes reading different parts of the email messages easy:

# Get one email
email = emails[0]

# String representation of the message
print(email.content)

# Email contents
print(email.text_body)
print(email.html_body)

# Email headers
print(email.from_)
print(email.to)
print(email.date)

Here is a complete example:

from redbox import EmailBox

box = EmailBox(host="localhost", port=0)
inbox = box['INBOX']

for msg in inbox.search(subject="example 2", unseen=True):

    # Process the message
    print(msg.subject)
    print(msg.text_body)

    # Set the message as read/seen
    msg.read()

See more from the documentation.

If the library helped you save time, consider buying a coffee for the maintainer ☕.

Author

Metadata

Release files for redbox2 0.2.3

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

Source distribution (sdist)

Source distribution for redbox2 0.2.3
File Size Uploaded
redbox2-0.2.3.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redbox2 0.2.3
File Interpreter ABI Platform
redbox2-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 33.1 kB

Release files / redbox2-0.2.3.tar.gz

Download URL redbox2-0.2.3.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3cf9ff97ad177215b318872a6cbd3e4387232d2067574145dfe744899709d148
BLAKE2b-256 checksum
How to use checksums
b19b4532b247f8be45e05c1356ba3d6b6fb3072529f46b2caf25752e10616ded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.16 Linux/4.19.0-24-amd64

Release files / redbox2-0.2.3-py3-none-any.whl

Download URL redbox2-0.2.3-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
406502d2e1a639131256734c99c173b6f89b953e616710f6e6d922239c35853b
BLAKE2b-256 checksum
How to use checksums
6fa5973eca523324010703ecc5720975cb8331a1d568e305a7288157f10ccb47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.16 Linux/4.19.0-24-amd64

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

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