RAJIV GANDHI ARTS AND SCIENCE COLLEGE
THAVALAKUPPAM, PUDUCHERRY
(AFFILIATED TO PONDICHERRY UNIVERSITY)
DEPARTMENT OF COMPUTER APPLICATIONS
III BCA (2023-2024)
ONLINE DJ BOOKING MANAGEMENT SYSTEM
BY
KARTHIKEYAN L (22CA0127)
KIRUBAKARAN (22CA0147)
KAVIARASAN G (22CA0129)
Project report submitted in partial fulfilment of the requirements for the degree of
BACHELOR OF COMPUTER APPLICATIONS
PONDICHERRY UNIVERSITY
UNDER THE GUIDANCE OF
DR.J. HANNAH MONISHA ([Link]., [Link]., PH.D)
(HEAD OF THE DEPARTMENT)
DEPARTMENT OF COMPUTER APPLICATION
BONAFIDE CERTIFICATE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
This is certify that the project work entitled “ ONLINE DJ BOOKING
MANAGEMENT SYSTEM” is a bonafide record of work done by
KARTHIKEYAN ,SKIRUBAKARAN,KAVIARASAN G, in partial fulfillment for the
degree of Bachelor of computer Science in Rajiv Gandhi Arts and Science college,
Thavalakuppam, Pondicherry University.
This work has not been submitted elsewhere for the award of similar or any other
degree to the best of our knowledge.
GUDIE HEAD OF THE
DEPARTMENT
Dr. J. HANNAH MONISHA,
([Link]., [Link]., PH.D)
Submitted for the university Examination held on at Rajiv Gandhi
arts and science college, Thavalakuppam, Puducherry.
INTERNAL EXAMINER EXTERNAL EXAMINER
2|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
INDEX
SI. NO CONTENTS PAGE NO
1. INTRODUCTION
2. OBJECTIVES
3. FEATURES
USER ROLE
4.
5. TECHNOLOGY STACK
6. ARCHITECTURE DIAGRAM
7. DATAFLOW DIAGRAM
8. TESTING
9. IMPLEMENTATION
10. APPENDIX
11. CONCLUSION
3|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
ACKNOWLEDGEMENT
The successful completion of Our Project “AI BASED-GMAIL
KEYWORD FILTERING AND AUTO FORWARDING SYSTEM” would
not be without mentioning the people who made it possible. We take this
privilege to express a few words of gratitude and respect to all those who helped
in the completion of this project.
We thank the almighty GOD who blessed us abundantly to accomplish
this project with great involvement.
We take immense pleasure in conveying our sincere thanks to our
beloved principal Dr. J. HANNAH MONISHA [Link]., [Link]., Ph.D.,
Rajiv Gandhi Arts and Science College, Pondicherry University, for
having permitted us to undertake this project.
We would like to convey our great thanks to our internal guide Dr. J.
HANNAH MONISHA [Link]., [Link]., Ph.D., Head of the department,
Department of computer applications, Rajiv Gandhi Arts and science college,
Pondicherry University, for her dedicated support and encouragement to
complete this project.
I wish to thank all the staff members of the Department of Computer
Science, Rajiv Gandhi Arts and Science College, for providing their kind help.
BY
K. CHITRA,
J. PRIYADHARSHINI,
S. SOWMIYA.
4|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
ABSTRACT
Title:
AI-Based Gmail Keyword Filtering and Auto-Forwarding System
Objective:
The project aims to develop an AI-powered system that automatically scans incoming Gmail
messages for predefined keywords and forwards relevant emails to a specified email address.
This solution is useful for students, professionals, and organizations that need to monitor
emails for important information without manually filtering them.
Methodology:
The system integrates with the Gmail API using OAuth authentication to access incoming
emails. Users can define a list of keywords (e.g., "Pondicherry exam,", "university exam," or
"exam", "test") through a web-based interface. The backend, built using Python and Flask,
fetches emails, extracts their content, and applies AI/Natural Language Processing (NLP)
techniques to determine keyword relevance. If an email matches the predefined criteria, it is
automatically forwarded to a specified recipient.
Implementation:
Frontend: A web-based user interface (HTML, CSS, JavaScript) for managing keywords.
Backend: Python with Flask for handling email processing and forwarding.
AI Integration: NLP libraries (spaCy/NLTK) for improved keyword detection.
Gmail API: Secure email fetching and sending via Google OAuth authentication.
Expected Outcome:
The system will reduce manual email monitoring efforts, ensuring that only relevant emails
reach the user based on predefined keywords. The AI-enhanced filtering mechanism will
improve accuracy, minimizing false positives and missed emails. This project can be
extended with advanced AI models, multi-user support, and notification systems (SMS,
Telegram, WhatsApp) for real-time updates.
Keywords:
AI, Gmail API, Keyword Filtering, Email Automation, NLP, Flask, Python, Auto-
Forwarding.
5|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
1. INTRODUCTION
Email remains one of the most essential communication tools in both professional and
personal domains. With the increasing volume of incoming emails, users often face
the challenge of identifying and prioritizing important messages amidst a flood of
irrelevant or less important ones. To address this, our project presents an AI-Based
Gmail Keyword Filtering and Auto-Forwarding System, which leverages machine
learning to intelligently classify emails and automate their management.
The primary goal of this project is to develop a smart email assistant that filters
incoming emails based on their content and user-defined keyword preferences. Using
a pre-trained BERT (Bidirectional Encoder Representations from Transformers)
model for natural language processing (NLP), the system classifies emails into
relevant categories such as Work, Personal, Promotion, or Spam. Once classified,
emails that match specific user criteria are automatically forwarded to a designated
email address.
The system is built using a Flask backend, integrated with the Gmail API for secure
access to the user's inbox. It authenticates users via OAuth 2.0, ensuring safe and
private access to Gmail data. A lightweight front-end interface allows users to interact
with the system, set forwarding preferences, and view results.
By combining AI-powered email classification with automation, this project offers a
practical solution to reduce manual effort, enhance productivity, and ensure that
critical emails are never missed. It demonstrates the power of AI and cloud APIs in
solving real-world problems through an efficient and user-friendly system.
1|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
2. OBJECTIVES
1. GENERAL OBJECTIVES
The primary objective of this project is to design and develop an AI-Based Gmail Keyword
Filtering and Auto-Forwarding System that leverages Natural Language Processing (NLP)
techniques to classify incoming emails and automatically forward them based on predefined
keyword rules. The system aims to enhance email management, reduce manual sorting
efforts, and improve communication efficiency by ensuring that important messages are
always prioritized and routed to the appropriate destination.
This project combines the power of machine learning, Gmail API integration, and web-based
automation to provide a smart and scalable solution for automated email handling. By
training an NLP model using the BERT (Bidirectional Encoder Representations from
Transformers) architecture, the system can effectively understand email context, classify
messages into categories such as Work, Personal, Promotions, or Spam, and perform
forwarding actions based on user-defined rules.
2. SPECIFIC OBJECTIVES
To achieve the overall project goal, the following specific objectives have been identified:
2.1. Gmail API Integration
Integrate the Gmail API into the system to access the user's inbox securely.
Use OAuth 2.0 for secure authentication and authorization to access Gmail data.
2.2. Email Fetching and Preprocessing
Retrieve unread or newly received emails from the user's Gmail account.
Extract key components such as sender, subject, and body content from each email.
Perform text cleaning and preprocessing to prepare the data for classification.
2|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
2.3. Email Classification Using BERT
Utilize a pre-trained BERT model to classify emails into categories based on their
content.
Fine-tune the model (if needed) using a labeled dataset to improve accuracy.
Map each category to specific user-defined rules for forwarding actions.
2.4. Keyword-Based Filtering
Allow users to define custom keyword-based filters to capture emails relevant to their
needs.
Combine AI classification and keyword matching to increase filtering accuracy.
2.5. Auto-Forwarding Mechanism
Automatically forward emails that match the user’s keyword or category filters to a
predefined email address.
Log forwarded email details such as subject, sender, timestamp, and destination.
2.6. Front-End Interface
Create a user-friendly interface for login, viewing email logs, and setting preferences.
Allow users to view which emails were classified, filtered, and forwarded.
2.7. Error Handling and Security
Ensure the system can handle Gmail API errors gracefully (e.g., token expiration, rate
limits).
Keep user credentials and tokens secure using OAuth standards and environment
variables.
2.8. System Testing and Evaluation
Test the system for accuracy, performance, and reliability across various email
samples.
Evaluate the classification model using precision, recall, and F1-score metrics.
2.9. Documentation and Deployment
3|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
Provide full system documentation including setup, configuration, and usage
instructions.
Make the system deployable on a local server or cloud platform.
4|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
3. FEATURES
The AI-Based Gmail Keyword Filtering and Auto-Forwarding System is designed to
automate the task of managing and routing emails based on their content and context. It
integrates artificial intelligence with secure Gmail access and keyword-based logic to provide
a seamless, intelligent email handling experience. Below is a comprehensive list of features
that define the functionality and capabilities of the system:
1. Gmail Integration via API
Secure integration with Gmail using Google’s official Gmail API.
Authentication is handled using OAuth 2.0, ensuring that the system can access email
data without compromising user credentials.
Permissions are granted via scopes defined during OAuth, with access limited to only
the necessary inbox operations (read and forward).
2. Automatic Email Fetching
The system periodically fetches unread or new emails from the user's inbox.
It parses key components such as sender, subject, timestamp, and email content.
Supports scalability for handling multiple messages in batches.
3. Email Content Preprocessing
Raw email data is cleaned and processed using natural language processing
techniques.
HTML tags, special characters, and noise are removed to enhance classification
accuracy.
Emails are tokenized and prepared as input for the AI model.
4. AI-Based Email Classification (BERT)
Utilizes a pre-trained BERT (Bidirectional Encoder Representations from
Transformers) model for email classification.
Accurately categorizes emails into relevant classes like Work, Personal, Promotions,
and Spam.
5|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
Supports future expansion for more categories or fine-tuning on custom datasets.
5. Keyword Filtering System
Users can define custom keyword filters to capture emails based on specific terms.
The system uses both AI classification and keyword matching for robust filtering.
Only emails that meet the criteria are considered for auto-forwarding.
6. Automated Email Forwarding
Emails matching classification or keyword rules are automatically forwarded to a
user-defined email address.
Forwarded messages retain original subject and body, ensuring context is preserved.
Supports logging and error handling for failed forwarding attempts.
7. User-Friendly Web Interface
Built with HTML, CSS, and JavaScript, the interface allows users to:
Authenticate with Gmail
View classification and forwarding logs
Monitor email processing results
Designed for ease of use and accessibility.
8. Error Handling and Token Management
Handles common Gmail API issues such as token expiration, invalid scopes, and API
rate limits.
Refresh tokens are used (if required) to maintain continuous operation.
Secure error messages and debug logging for developers.
9. Modular and Scalable Architecture
Built on Flask, allowing modular expansion of features.
Easily deployable on local servers or cloud platforms (e.g., Google Cloud, Heroku).
Designed for extensibility with minimal configuration.
10. Lightweight and Efficient
Uses a minimal tech stack to remain lightweight, fast, and efficient.
6|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
SQLite ensures simple, portable storage without complex DB setup.
Minimal dependencies make it suitable for academic, research, and real-world use.
4. USER ROLE
7|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
The primary user of this system is an individual who wishes to automate the classification
and forwarding of their Gmail messages based on content relevance. The user interacts with
the system through a simple web interface and Gmail authentication mechanism. Below are
the key roles and responsibilities of the user within the system:
1. Authentication
The user initiates access to their Gmail account using OAuth 2.0 authentication.
Upon successful login, the system gains limited access (with the user's consent) to
read and forward emails.
2. Configuration
The user sets keywords and forwarding rules that define which types of emails should
be classified or auto-forwarded.
Users may specify the target email address to which relevant messages should be sent.
3. Monitoring
Users can view logs of classified and forwarded emails via a web-based dashboard or
log viewer.
Each log includes sender details, classification labels, and timestamps.
4. Decision-Making (Optional)
Although the system is automated, the user can optionally verify classification results
or adjust filtering rules based on observed behavior.
5. Feedback & Maintenance
8|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
Users may provide feedback by refining keyword filters or changing the forwarding
address.
They may also update permissions or revoke access through their Google Account
settings if need
In this system, the user plays a minimal but critical role. Once initial authentication and rule
configuration are complete, the system operates autonomously, requiring minimal user
intervention while maintaining transparency and control.
9|Page
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
5. TECHNOLOGY STACK
This project uses a combination of web technologies, machine
learning tools, and Gmail integration to build the email filtering and
forwarding system. Below are the main technologies used.
Frontend:
HTML – To create the structure of the webpage
CSS – To style the page and make it look neat
JavaScript – To make the page interactive (like showing logs)
Backend:
Python – Main programming language for building logic
Flask – A lightweight web framework used to connect frontend
and backend
AI & Machine Learning:
BERT Model – A powerful AI model used to understand and
classify emails
Transformers Library (Hugging Face) – Helps us use BERT
easily
Pandas/Numpy – Used to handle data and perform simple tasks
Email & Google Integration:
Gmail API – Lets us read and forward emails from the user’s
Gmail account
10 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
OAuth 2.0 – A secure way to log in to Gmail without sharing
passwords
Tools:
PYCHARM Code – Used for writing and editing the code
ARCHITECTURE
Creating an architecture for an AI-based auto forwarding system involves combining several
components, including data ingestion, AI/ML processing, decision-making logic, and action
execution (like forwarding messages, emails, tickets, etc.). Here's a high-level architectural
breakdown:
1. HIGH-LEVEL COMPONENETS
1. Input Sources
Emails, messages, support tickets, logs, etc.
APIs, webhooks, or real-time listeners.
2. Ingestion Layer
Parses and normalizes input.
May include message brokers like Kafka, RabbitMQ for handling real-time data.
3. Preprocessing Layer
Cleans and structures data.
NLP pipeline: tokenization, sentiment analysis, keyword extraction, etc.
4. AI/ML Engine
Classification models: categorize content (e.g., spam, support request, sales lead).
11 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
Named entity recognition (NER) to extract context (e.g., customer name, issue type).
Decision logic to determine forwarding destination.
5. Routing Engine
Business rules + ML output used to decide where to forward.
Integrates with directory or CRM to find recipient or group.
6. Forwarding/Action Layer
Sends messages/emails to intended recipients.
Logs activity for auditing/tracking.
7. Monitoring & Feedback
Tracks forwarding success, user corrections (e.g., "this was wrongly forwarded").
Feeds back into model for improvement.
8. Dashboard (Optional)
Admin view for monitoring, configuring rules, and model feedback.
2. EXAMPLE TECH STACK
Tech Stack Used:
Frontend: HTML, CSS, and JavaScript were used to create a responsive and user-
friendly interface for interacting with the system.
Backend: Flask (Python) was chosen as the lightweight web framework to handle
server-side logic and API communication.
AI Model: A BERT-based text classification model was used to analyze email content
and categorize messages based on predefined keywords.
12 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
API Integration: Gmail API was integrated using OAuth 2.0 for secure authentication
and access to the user's Gmail account for email reading and forwarding.
Deployment: The application was deployed using a cloud platform like Heroku or
Google Cloud for easy access and scalability.
3. EXAMPLE FLOW
1. Email arrives at the system (via webhook or polling).
2. Message gets parsed and cleaned.
3. AI model classifies the intent ("support issue", "sales", etc.).
4. Routing logic checks the best recipient.
5. Message gets forwarded (e.g., to a Slack channel or CRM system).
6. Logs are created, and feedback is optionally gathered.
13 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
6. ARCHITECTURE DIAGRAM
14 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
7. DATAFLOW DIAGRAM
15 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
EXPLANATION OF DATAFLOW DIAGRAM
16 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
Here’s a clear explanation of the Data Flow Diagram (DFD) for an AI-based Gmail Keyword
Filtering and Auto-Forwarding System without a database:
1. User
Authorizes the app to access their Gmail via OAuth 2.0.
Sets up keyword rules (stored in memory or config files).
2. Fetch Emails (Process)
Uses Gmail API to retrieve recent emails from the user's inbox.
3. Gmail Keyword Filtering (Process)
An AI/NLP model analyzes the email’s subject/body.
Checks for keywords, topics, or context.
4. Forwarding Rules (Config File / Memory)
Rules are stored temporarily in memory or static files (e.g., JSON).
No database involved.
5. Apply Forwarding Logic (Process)
If the email matches a rule, it’s passed to forwarding.
6. Auto Forwarding (External Entity)
Uses Gmail API to forward email to target recipient(s).
7. Logging (Optional, In-Memory or Console)
Basic logs stored in RAM or console (not persistent).
The data flow diagram starts with the user authorizing Gmail access and setting keyword
rules, which are stored in memory or a config file. The system fetches emails using the Gmail
API and passes them through an AI/NLP filter that checks for keyword matches. If a match is
17 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
found, the system refers to in-memory forwarding rules to determine the target recipient. The
email is then forwarded using the Gmail API. No database is used; all logic runs in memory,
making it lightweight and efficient.
8. TESTING
18 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
7.1 UNIT TESTING
Unit Testing is a type of software testing where individual components of the Gmail
keyword filtering and auto-forwarding system are tested in isolation. The goal is to ensure
that each part—such as email fetching via Gmail API, keyword detection using AI/NLP, and
the forwarding logic—functions correctly as per its design. These tests are conducted during
the development phase by developers using automated testing tools. For example, mock
emails are used to test the filtering logic, and Gmail API calls are simulated to validate the
forwarding process. Unit testing helps confirm that the system behaves as intended before full
integration or deployment.
7.2 INTEGRATION TESTING
Integration testing is the second phase of testing, following unit testing, where
individual components of the Gmail keyword filtering and auto-forwarding system are tested
together as a group. This phase ensures that modules like the Gmail API integration, AI-
based keyword filtering, rule-matching logic, and auto-forwarding functionalities work
correctly when combined. Since these modules may be developed by different developers or
teams, integration testing checks for issues in their interactions—such as email data flow
from the API to the AI filter, and then to the forwarding module. The main goal is to validate
that all integrated parts of the system communicate and function seamlessly as a whole.
7.3 VALIDATION TESTING
Validation testing is the process of ensuring that the tested and developed software
satisfies the client/user’s needs. The business requirement logic or scenarios have to be tested
in detail. All the critical functionalities of an application must be tested here. As a tester, it is
always important to know how to verify the business logic or scenarios that are given to you.
19 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
One such method that helps in detailed evaluation of the functionalities is the Validation
Process. It's convert to Ai based gmail keyword filtering and auto forwarding system.
7.4 FUNCTIONAL TESTING
Functional testing for the AI-based Gmail Keyword Filtering and Auto-Forwarding
System involves designing test scenarios that validate each core functionality of the system,
such as email fetching, keyword detection, rule matching, and automatic forwarding. Diverse
test data is used to simulate various email types and content conditions. Test cases cover
aspects like accurate keyword classification, correct rule application, forwarding behavior,
and response to different email formats. Performance metrics such as precision, recall, and
accuracy are measured to evaluate AI filtering efficiency. Edge case and regression tests
ensure the system handles unexpected input and remains stable after updates. User
acceptance testing helps verify that the system meets practical usability and real-world
expectations. Documentation of all tests and outcomes ensures transparency and reliability
for stakeholders.
7.5 WHITE BOX TESTING
White box testing for the AI-based Gmail Keyword Filtering and Auto-
Forwarding System involves thoroughly analyzing the internal logic and source code of
the application. Developers write unit tests to validate individual modules such as email
fetching, AI-based keyword classification, and forwarding logic. Code coverage tools
ensure all branches and decision paths are tested. Boundary value analysis is used to
verify correct behavior when handling unusual or edge-case email content. Mutation
testing helps evaluate the effectiveness of the test suite. Static code analysis tools
20 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
identify potential coding issues or security risks in Gmail API handling and rule
execution. Integration tests verify that internal modules interact properly, while
performance profiling is conducted to optimize processing time. Code reviews ensure
the implementation follows clean coding practices and standards, helping detect defects
early in the development lifecycle.
7.6 BLACK BOX TESTING
Black box testing for the AI-based Gmail Keyword Filtering and Auto-Forwarding
System involves designing test scenarios based on system requirements without considering
the internal code structure. Testers use a variety of email samples with different subjects,
content, and formats to validate the system's external behavior. The focus is on verifying the
accuracy of keyword detection, the correctness of auto-forwarding actions, and the system's
responsiveness. Expected outcomes are compared with actual results to ensure functionality
aligns with user-defined rules. Regression testing is conducted after updates to confirm that
existing features remain unaffected. User acceptance testing assesses the system’s usability in
real-world scenarios. All results are documented to provide clear insights to stakeholders and
confirm that the system meets its functional requirements reliably.
9. IMPLEMENTATION
This chapter covers the practical implementation of the AI-based Gmail Keyword
21 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
Filtering and Auto-Forwarding System. It explains how the individual components of the
system were developed and integrated to function as a unified application.
5.1 SYSTEM OVERVIEW
The system is designed to classify incoming emails using a fine-tuned BERT
(Bidirectional Encoder Representations from Transformers) model and automatically forward
important emails based on pre-defined keywords or categories. The implementation includes:
Frontend: Developed with HTML, CSS, and JavaScript to provide user interaction
and configuration options.
Backend: A Flask-based web server handles model inference, Gmail API
communication, and email forwarding.
AI Model: BERT-based NLP model trained for multi-class email classification.
Gmail API: Integrated using OAuth 2.0 to access Gmail inbox, read emails, and send
them as needed.
5.2 TECHNOLOGY STACK
22 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
5.3 AI MODEL INTEGRATION
1. Model Selection: Pre-trained BERT from HuggingFace Transformers library.
2. Training: Fine-tuned using a dataset of labeled emails.
3. Inference: Model is loaded in the Flask backend and used to classify incoming emails in
real-time.
4. Preprocessing:
Email content is cleaned.
Tokenized using BERT tokenizer.
Padded and passed through the model to get predicted labels.
5.4 GMAIL API INTEGRATION
1. Authentication:
23 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
Used Google Cloud Console to create OAuth 2.0 credentials.
User grants permission via the consent screen.
Tokens are securely stored and refreshed automatically.
2. Fetching Emails:
Gmail API used to read recent emails via [Link] and [Link].
3. Filtering Logic:
Emails are passed through the AI model.
If prediction matches user-selected category/keyword, email is flagged for forwarding.
4. Auto-Forwarding:
Email is forwarded using [Link].
The recipient is chosen based on user settings.
5.5 FRONTNED DESIGN
Responsive UI for configuring:
Keywords
Email categories
Recipient forwarding address
Status dashboard for:
Gmail connection
Number of emails processed
Last action performed
5.6 DEPLOYMENT
The application was containerized using Docker and deployed on Render (or another
PaaS).
24 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
Environment variables were configured for API credentials and tokens.
Cron jobs or scheduled tasks were configured to check for new emails periodically.
5.7 ERROR HANDLING AND LOGGING
1. Used Python's logging module for backend logging.
2. Implemented exception handling for:
Token expiration
API rate limits
Model errors
3. UI shows error messages in case of authentication or forwarding failures.
10. APPENDIX
APPENDIX A: FRONTEND
25 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
CODING
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gmail Inbox Clone</title>
<style>
body { font-family: Arial; margin: 0; background-color: #f1f3f4; }
.sidebar {
width: 220px; background: #fff; height: 100vh; position: fixed; padding:
10px;
border-right: 1px solid #ddd;
}
.main {
margin-left: 240px; padding: 20px;
}
.header {
background: #fff; padding: 15px 20px; border-bottom: 1px solid #ddd;
display: flex; justify-content: space-between; align-items: center;
}
.inbox {
background: #fff; margin-top: 20px; border: 1px solid #ddd; border-
radius: 5px;
}
.email {
padding: 15px; border-bottom: 1px solid #eee;
}
.email:last-child { border-bottom: none; }
26 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
.email h3 { margin: 0; font-size: 16px; color: #202124; }
.email p { margin: 5px 0 0; font-size: 14px; color: #5f6368; }
.run-btn {
background: #1a73e8; color: #fff; border: none; padding: 8px 16px;
border-radius: 4px; cursor: pointer;
}
</style>
</head>
<body>
<div class="sidebar">
<h2>Gmail UI</h2>
<a href="#">Inbox</a>
<a href="#">Starred</a>
<a href="#">Sent</a>
</div>
<div class="main">
<div class="header">
<h2>Inbox</h2>
<button class="run-btn" onclick="runGmailService()">Run Gmail
Filter</button>
</div>
<div class="inbox" id="inbox-container"></div>
</div>
<script>
function runGmailService() {
fetch('/run-filter', { method: 'POST' })
27 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
.then(res => [Link]())
.then(data => {
alert([Link]);
fetch('/get-emails')
.then(res => [Link]())
.then(data => {
const container = [Link]('inbox-container');
[Link] = '';
[Link](email => {
const div = [Link]('div');
[Link] = 'email';
[Link] = `<h3>${[Link]}</h3><p>From: $
{[Link]}</p>`;
[Link](div);
});
});
});
}
</script>
</body>
</html>
DESIGN
28 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
APPENDIX B: BACKEND
29 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
CODING
from logging import exception
from flask import Flask, render_template, jsonify, request
from [Link] import Request
from [Link] import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from [Link] import build
from [Link] import HttpError
import [Link]
import base64
from [Link] import MIMEText
from [Link] import MIMEMultipart
import re
app = Flask(__name__)
SCOPES = ['[Link]
KEYWORDS = ['urgent', 'important', 'action required']
FORWARD_TO = 'chitrakumar150805@[Link]'
cached_emails = []
def authenticate_gmail():
creds = None
if [Link]('[Link]'):
creds = Credentials.from_authorized_user_file('[Link]', SCOPES)
if not creds or not [Link]:
if creds and [Link] and creds.refresh_token:
[Link](Request())
30 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
else:
flow = InstalledAppFlow.from_client_secrets_file('[Link]',
SCOPES)
creds = flow.run_local_server(port=8080)
with open('[Link]', 'w') as token:
[Link](creds.to_json())
return build('gmail', 'v1', credentials=creds)
def search_emails(service):
try:
results = [Link]().messages().list(userId='me', labelIds=['INBOX'],
q='').execute()
return [Link]('messages', [])
except HttpError as error:
print(f'Error searching emails: {error}')
return []
def get_email_details(service, msg_id):
try:
message = [Link]().messages().get(userId='me',
id=msg_id).execute()
payload = message['payload']
headers = [Link]('headers', [])
parts = [Link]('parts', [])
email_data = {'subject': '', 'from': '', 'body': '', 'snippet':
[Link]('snippet', '')}
for header in headers:
if header['name'] == 'Subject':
31 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
email_data['subject'] = header['value']
if header['name'] == 'From':
email_data['from'] = header['value']
for part in parts:
if part['mimeType'] == 'text/plain' and 'data' in part['body']:
data = part['body']['data']
email_data['body'] = base64.urlsafe_b64decode(data).decode('utf-8')
break
return email_data
except HttpError as error:
print(f'Error getting email: {error}')
return None
def filter_emails(emails):
filtered = []
for email in emails:
for keyword in KEYWORDS:
if [Link](r'\b' + keyword + r'\b', [Link]('subject', ''),
[Link]) or \
[Link](r'\b' + keyword + r'\b', [Link]('body', ''),
[Link]):
[Link](email)
break
return filtered
def create_message(to, subject, message_text):
message = MIMEMultipart()
32 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
message['to'] = to
message['subject'] = subject
msg = MIMEText(message_text)
[Link](msg)
raw = base64.urlsafe_b64encode(message.as_bytes())
return {'raw': [Link]()}
def send_email(service, message):
try:
return [Link]().messages().send(userId='me',
body=message).execute()
except HttpError as error:
print(f'Error sending email: {error}')
return None
@[Link]('/')
def home():
return render_template('another_page.html')
@[Link]('/run-filter', methods=['POST'])
def run_filter():
global cached_emails
service = authenticate_gmail()
messages = search_emails(service)
email_details = []
for msg in messages:
details = get_email_details(service, msg['id'])
if details:
33 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
email_details.append(details)
filtered = filter_emails(email_details)
cached_emails = filtered
for email in filtered:
subject = f"Fwd: {email['subject']}"
body = f"From: {email['from']}\n\n{email['body']}"
msg = create_message(FORWARD_TO, subject, body)
send_email(service, msg)
return jsonify({'message': f'{len(filtered)} email(s) filtered and forwarded.'})
@[Link]('/get-emails')
def get_emails():
return jsonify({'emails': cached_emails})
if __name__ == '__main__':
[Link](debug=True)
BACKEND DESIGN
34 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
35 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
36 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
37 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
38 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
11. CONCLUSION
Conclusion
In conclusion, the development of the e-commerce website for the furniture
showroom has been successfully completed, offering a comprehensive platform for both
administrators and customers to interact with the showroom's offerings. Throughout the
project, various technologies and functionalities have been implemented to ensure a seamless
user experience and efficient management of product advertisements.
The project features an intuitive and user-friendly admin panel, allowing
administrators to effortlessly upload, update, and manage product advertisements. With the
ability to add details such as product name, price, description, and images, administrators
have full control over showcasing the showroom's furniture collection to potential customers.
For customers, the website provides a visually appealing and easy-to-navigate
interface, enabling them to browse through the available products, view detailed information,
and conveniently add items to their cart for purchase. The inclusion of features such as user
account creation and cart management enhances the shopping experience, allowing customers
to track their orders and manage their preferences effectively.
Additionally, the incorporation of feedback functionality enables customers to provide
valuable insights and suggestions, contributing to the continuous improvement of the
showroom's services and offerings. Administrators can access and review feedback
submissions, allowing them to address any concerns or issues raised by customers promptly.
Overall, the e-commerce website for the furniture showroom serves as a powerful tool
for promoting the showroom's products, attracting customers, and facilitating seamless
transactions. With its robust features and user-centric design, the website aims to elevate the
showroom's online presence and establish itself as a prominent destination for furniture
shopping.
As the project concludes, ongoing maintenance and updates will be essential to ensure
the website's functionality remains optimal and continues to meet the evolving needs of both
39 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE
ONLINE DJ BOOKING MANAGEMENT SYSTEM
administrators and customers. With a commitment to excellence and customer satisfaction,
the e-commerce website for the furniture showroom is poised for success in the competitive
online marketplace.
40 | P a g e
RAJIV GANDHI ARTS AND SCIENCE COLLEGE