Skip to main content

Email box reading library

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redbox-0.2.0.tar.gz (64.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redbox-0.2.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file redbox-0.2.0.tar.gz.

File metadata

  • Download URL: redbox-0.2.0.tar.gz
  • Upload date:
  • Size: 64.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for redbox-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7c131829cb9bce6001931ac818946aad1765fa7047ac581427c2e393fc734563
MD5 89fd6b0f0439900898fb553fafbfacab
BLAKE2b-256 acc2b95c58c46d5add9b669103bc1f137cf6c024e66dae76adb4e294ef71a7a8

See more details on using hashes here.

File details

Details for the file redbox-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: redbox-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for redbox-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48bc45be9c4bef60f5ad16570cc6de273e0cd33948eb91dc37d7a01c1fc15d18
MD5 83f6e6d0f4314bb23ca7d9989ff190fd
BLAKE2b-256 9711ff8c45993220593fa7b63386108ab60f02911b2c1aaffad610280d48ac00

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page