Getting started¶
Install the package from Pypi:
pip install redbox
Configuring Email Box¶
You can configure your email box by:
from redbox import EmailBox
box = EmailBox(
host='<IMAP HOST>',
port='<IMAP PORT>',
username='<USERNAME>',
password='<PASSWORD>'
)
Note
The correct IMAP port is typically 993.
There are guides to set up the following email providers:
Note
By default, Red Box uses IMAP4_SSL as the protocol. This is suitable for majority of cases but if you need to use other protocols, see Custom Configuration.
List of Folders¶
Get list of available email folders:
box.mailfolders
Selecting a Folder¶
To select a folder, you can index the box:
inbox = box["INBOX"]
Alternatively you can choose the inbox using:
inbox = box.inbox
Reading Emails¶
To query emails, you can just use search
method:
inbox.search(unseen=True)
Next tutorial covers reading emails more thoroughly.