[
{
"select": "all",
"rules": [{
"field": "subject",
"value": "Assignment",
"condition": "contains"
}],
"action": {"command": "mark", "value": "unread"}
}
]
field
inside rules list - subject
, mail_to
,
mail_from
, email_received_date
, body
.condition
- contains
, does not contains
, equal
, does not equal
when field is string type.condition
when field is email_received_date
- equal
, does not equal
, greater than
, less than
.Fetch OAuth Credentials from console.cloud.google.com. Click on the link to see step by step how to access credentials from google.
Clone the repository using command.
git clone git@github.com:mridubhatnagar/email_client.git
cd email_client
emailclient
is the virtual environment name. You can give any name of your choice.python3 -m venv ~/emailclient
source ~/emailclient/bin/activate
pip install -r requirements.txt
export ENV=local
fetch_email.py
accepts init
as
command line argument. This command will initialize the database.python fetch_email.py init
fetch_email.py
followed by the count of emails you wish to download.python fetch_email.py 10
[
{
"select": "all",
"rules": [{
"field": "subject",
"value": "Assignment",
"condition": "contains"
}],
"action": {"command": "mark", "value": "unread"}
}
]
python process_email.py
process_email.py
will filter downloaded emails based on the rules. And, perform the requested action.
Compare the expected result with the changes that have happened in your gmail.
export ENV=test
pytest tests\<filename> -s