Skip to content

A real-time email content analysis tool that simulates spam detection using a keyword-based machine learning model. The web application allows users to paste email content and get an instant prediction of whether the email is spam or legitimate (ham). Built with HTML, Tailwind CSS, and JavaScript for the front-end and includes a mock ML simulation.

Shikha18Shukla/Spam_email_detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

##πŸ›‘οΈ SecureMail Analyzer - Spam Email Detector

SecureMail Analyzer is a real-time email content analysis tool that detects spam emails using a Machine Learning (ML) model trained on labeled email datasets. The system analyzes message content and predicts whether an email is SPAM or HAM (legitimate).

Built with Python (Scikit-learn, Flask) for the backend and HTML, Tailwind CSS, and JavaScript for the frontend, this project demonstrates both ML implementation and web integration in a simple, educational, and visually interactive way.

#πŸš€ Features

Machine Learning-Based Detection: Uses trained ML algorithms to classify email content as SPAM or HAM. High Accuracy: Achieved an accuracy of 96% on the test dataset using a Multinomial Naive Bayes model. Real-Time Prediction: Instantly analyzes pasted email content and displays classification results. Dynamic Result Visualization: Displays predictions with color-coded alerts, confidence scores, and icons. Responsive UI: Built with Tailwind CSS for smooth animations and mobile-friendly layout. Customizable Model: Supports retraining with new data for improved accuracy.

#🧠 Machine Learning Model

Algorithm Used: Multinomial Naive Bayes Libraries: Scikit-learn, Pandas, NumPy, Joblib Dataset: emails.csv (contains labeled email text for spam/ham classification) Accuracy: ~96% on test data Training File: train_model.py Prediction File: predict.py

#Model Workflow

Data Preprocessing: Cleaned and tokenized email text. Feature Extraction: Used TF-IDF vectorization for text representation. Model Training: Trained a Multinomial Naive Bayes classifier. Model Saving: Saved the trained model using Joblib for deployment. Real-Time Prediction: Integrated with Flask to predict user input in real time.

#πŸ’» Tech Stack Frontend: HTML, Tailwind CSS, JavaScript Backend: Python (Flask) Machine Learning: Scikit-learn, Pandas, NumPy Icons: Lucide Icons Model Storage: Joblib

##🧩 Project Structure Spam_Email_Detector/ β”‚ β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ app.py
β”‚ β”œβ”€β”€ predict.py
β”‚ β”œβ”€β”€ train_model.py
β”‚ └── init.py β”‚ β”œβ”€β”€ data/ β”‚ └── emails.csv
β”‚ β”œβ”€β”€ models/ β”‚ └── email_model.joblib
β”‚ β”œβ”€β”€ template/ β”‚ └── index.html
β”‚ β”œβ”€β”€ requirements.txt β”œβ”€β”€ README.md └── .gitignore

#βš™οΈ How to Run Clone the repository: git clone https://github.com/Shikha18Shukla/Spam_email_detector.git cd Spam_email_detector

#πŸ“Š Example Predictions Email Example Prediction Confidence "Congratulations! You’ve won a $1000 gift card!" SPAM 98% "Reminder: Your meeting is scheduled for tomorrow at 10am." HAM 94% "Buy cheap meds online, limited-time offer!" SPAM 97%

Author: Shikha Shukla GitHub: Shikha18Shukla

##Frontend : Code_1EHTy1m3g0 brave_jNTQQQk7c3 brave_fNoBW1gX2I brave_5XnZ2kcKhV 7_1a5fd76b](https://github.com/user-attachments/assets/2264a5e8-9d03-45cf-9b9a-9a6fd6bbcfbc)

About

A real-time email content analysis tool that simulates spam detection using a keyword-based machine learning model. The web application allows users to paste email content and get an instant prediction of whether the email is spam or legitimate (ham). Built with HTML, Tailwind CSS, and JavaScript for the front-end and includes a mock ML simulation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published