Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefen-taime/gmail-to-mongodb-script
This script facilitates the automation of fetching emails from a user's Gmail account and storing them into a MongoDB database. The emails fetched are filtered by specific labels such as Promotions, Social, Updates, and Forums. The script is intended to run continuously, checking for new emails every minute.
https://github.com/stefen-taime/gmail-to-mongodb-script
Last synced: about 4 hours ago
JSON representation
This script facilitates the automation of fetching emails from a user's Gmail account and storing them into a MongoDB database. The emails fetched are filtered by specific labels such as Promotions, Social, Updates, and Forums. The script is intended to run continuously, checking for new emails every minute.
- Host: GitHub
- URL: https://github.com/stefen-taime/gmail-to-mongodb-script
- Owner: Stefen-Taime
- Created: 2023-10-27T14:07:53.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-27T14:13:55.000Z (about 1 year ago)
- Last Synced: 2023-10-27T15:28:51.539Z (about 1 year ago)
- Language: Python
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gmail to MongoDB Atlas Script
## Description
This script facilitates the automation of fetching emails from a user's Gmail account and storing them into a MongoDB Atlas Cloud database. The emails fetched are filtered by specific labels such as Promotions, Social, Updates, and Forums. The script is intended to run continuously, checking for new emails every minute.
## Dependencies
- `google-auth`
- `google-auth-oauthlib`
- `google-auth-httplib2`
- `google-api-python-client`
- `pymongo`
- `schedule`You can install the necessary dependencies via pip:
```bash
pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client pymongo schedule
```
## Setup1. Create a project on the [Google Cloud Platform Console](https://console.cloud.google.com/).
2. Enable the Gmail API for your project.
3. Download the client configuration file `credentials.json` and place it in the root directory of this script.
4. Setup a MongoDB Atlas cluster and obtain the connection string.## Configuration
- Set up your Gmail API credentials and save them as `credentials.json` in the script directory.
- Update the MongoDB connection string in the `MongoClient` instantiation within the `send_emails_to_mongodb` function.## Usage
Run the script from the command line:
```bash
python gmail.py