Skip to content

Latest commit

Β 

History

History
72 lines (50 loc) Β· 2.46 KB

File metadata and controls

72 lines (50 loc) Β· 2.46 KB

πŸ“§ AI-powered Mail Classifier

πŸ“Š Project Presentation

You can view the project presentation made by my friend and who we participated in Hackathon with here:
➑️ View on Google Drive


πŸ“š Overview

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.

πŸ—‚οΈ Project Structure

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

βš™οΈ Dependencies

  • google-auth
  • google-auth-oauthlib
  • google-api-python-client
  • beautifulsoup4
  • html2text
  • (optional) openai

Install them with:

pip install google-auth google-auth-oauthlib google-api-python-client beautifulsoup4 html2text openai

πŸš€ How to Use

  1. Make sure your email data exists in stuff.json or mails.json.
  2. 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)
  1. Output will be saved in files like newMails.json or stuff.json.

πŸ” Gmail Integration

The another.py script uses Google's OAuth2 flow:

  • Requires a credentials.json file from Google Cloud Console.
  • Generates token.json after first-time authentication.
  • SCOPES used include Gmail read access.

πŸ“ Notes

  • File paths in scripts may need adjusting to your system.
  • Gmail access requires manual API setup.
  • OpenAI functionality in logics.py may be incomplete or require your API key.

πŸ‘€ Author

Project contents derived directly from submitted source code. No external assumptions added.