You can view the project presentation made by my friend and who we participated in Hackathon with here:
➡️ View on Google Drive
This project is designed to classify and process email data stored in JSON format. It uses HTML parsing, data transformation, and optional OpenAI-based classification to organize emails into a structured format. The project includes scripts for Gmail API integration, data loading, and content transformation.
AI-powered_Mail_Classifier/
├── another.py # 🔐 Gmail API authentication and token management
├── gettingJson.py # 📥 Loads and parses raw email data from stuff.json
├── json_creator.py # 🛠 Converts HTML content to plain text and saves as JSON
├── logics.py # 🤖 Contains logic for processing emails, may include OpenAI
├── mails.json # 📄 Sample input email data
├── newMails.json # 🧪 Intermediate processed data
├── stuff.json # 📦 Raw input data
└── .gitignore # 🚫 Git ignored files
google-authgoogle-auth-oauthlibgoogle-api-python-clientbeautifulsoup4html2text- (optional)
openai
Install them with:
pip install google-auth google-auth-oauthlib google-api-python-client beautifulsoup4 html2text openai- Make sure your email data exists in
stuff.jsonormails.json. - Run the scripts in sequence:
python gettingJson.py # Step 1: Load and clean JSON email data
python json_creator.py # Step 2: Convert HTML to text and structure it
python logics.py # Step 3: Process emails (logic or OpenAI)- Output will be saved in files like
newMails.jsonorstuff.json.
The another.py script uses Google's OAuth2 flow:
- Requires a
credentials.jsonfile from Google Cloud Console. - Generates
token.jsonafter first-time authentication. - SCOPES used include Gmail read access.
- File paths in scripts may need adjusting to your system.
- Gmail access requires manual API setup.
- OpenAI functionality in
logics.pymay be incomplete or require your API key.
Project contents derived directly from submitted source code. No external assumptions added.