{"id":25213989,"url":"https://github.com/hediske/emailspamprotection","last_synced_at":"2026-05-07T04:36:09.283Z","repository":{"id":276697113,"uuid":"930001208","full_name":"hediske/EmailSpamProtection","owner":"hediske","description":"Spam email detection using Logisitic Regression Model and TF-IDF Vectorizer for Feature extraction. Integration for different Email providers (GMAIL,OUTLOOK,YAHOO) by connecting to IMAP server , classifying unseen Emails and storing marked emails as Spam in Junk/Spam folder.","archived":false,"fork":false,"pushed_at":"2025-02-09T22:07:51.000Z","size":328,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T08:28:01.113Z","etag":null,"topics":["classification","imap","logisitc-regression","ml","mx-records","python","streamlit","tf-idf"],"latest_commit_sha":null,"homepage":"https://mailprotect.streamlit.app/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hediske.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-09T21:52:17.000Z","updated_at":"2025-02-20T02:15:57.000Z","dependencies_parsed_at":"2025-02-09T23:30:04.904Z","dependency_job_id":null,"html_url":"https://github.com/hediske/EmailSpamProtection","commit_stats":null,"previous_names":["hediske/emailspamprotection"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hediske/EmailSpamProtection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hediske%2FEmailSpamProtection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hediske%2FEmailSpamProtection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hediske%2FEmailSpamProtection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hediske%2FEmailSpamProtection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hediske","download_url":"https://codeload.github.com/hediske/EmailSpamProtection/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hediske%2FEmailSpamProtection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002000,"owners_count":26083258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","imap","logisitc-regression","ml","mx-records","python","streamlit","tf-idf"],"created_at":"2025-02-10T16:58:08.077Z","updated_at":"2025-10-09T20:34:06.354Z","avatar_url":"https://github.com/hediske.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# MailProtect : Your Email Spam Protection\n\n## Overview\nThis project is a spam detection and email protection system that uses a linear  model to classify messages as spam or not spam. The system includes a web application for spam detection and a script for processing emails and marking spam.\n\n## Motivation\nEmail spam is a significant issue, with billions of spam emails sent daily. Spam emails can lead to phishing attacks, malware infections, and data breaches. According to recent statistics:\n - Over 50% of all email traffic is spam.\n - Phishing attacks account for 90% of data breaches.\n - The average cost of a data breach is $3.86 million.\nThis project aims to provide a robust solution for detecting and managing spam emails, helping to protect users from potential threats.\n\n## Project Structure\n```\napp.py\ncredentials.txt\ndata/\n    spam.csv\nmodel.py\nnotebooks/\n    spam-detection.ipynb\nprotection.py\nreadme.md\nrequirements.txt\ntest/\n    test.py\nmodels/\n    tfid_vectorizer.pkl\n    logistic_regression.pkl\n```\n\n## How to Run the Project\n### Prerequisites\nPython 3.x\nRequired Python packages (listed in `requirements.txt`)\n### Installation\n1. Clone the repository:\n```\ngit clone https://github.com/your-repo/spam-detection.git\ncd spam-detection\n```\n2. Install the required packages:\n```\npip install -r requirements.txt\n```\n\n### Running the Web Application\nTo test the web application for spam detection:\nExecute the app.py script:\n```\nstreamlit run app.py\n```\nOpen your web browser and navigate to the URL provided by Streamlit.\n\n### Running the Email Protection Script\nThe email protection script can be run in two modes: normal mode and job mode.\n\n#### Normal Mode\nYou can run the script once .\nEnsure your email credentials are stored in `credentials.txt` in the format username:password.\nExecute the `protection.py` script:\n```\npython protection.py\n```\n#### Job Mode\nYou can execute a cron job to fetch and process emails in every 5 mins.\nEnsure your email credentials are stored in `credentials.txt` in the format username:password.\nExecute the `protection.py` script with the --job argument:\nIn job mode, the script will run periodically (every 5 minutes by default) to fetch and process emails.\n```\npython protection.py --job\n```\n\n\n### How the protection script works \n1. **Load Credentials**: The script loads email credentials from `credentials.txt`.\n2. **Connect to Email Provider**: It connects to the email provider's IMAP server using the credentials.\n3. **Fetch Emails**: The script fetches unseen emails from the inbox.\n4. **Extract Email Content**: It extracts the subject and body of each email.\n5. **Detect Spam**: The script uses the pre-trained logistic regression model and TF-IDF vectorizer to classify emails as spam or not spam.\n6. **Mark Spam**: If an email is classified as spam, it is marked accordingly in the inbox and stored in the Spam/Junk folder.\n\n### How to enable IMAP server connection for Gmail\nTo enable imap mail reading in gmail you need to :\n\n1) Enable `less secure apps` feature : https://myaccount.google.com/lesssecureapps?pli=1\n\n2) Enable Imap setting in Gmail(Not Google) Gmail Settings -\u003e Forwarding and POP / IMAP -\u003e IMAP Access to Enable IMAP\n\n### License\nThis project is licensed under the MIT License. See the LICENSE file for more details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhediske%2Femailspamprotection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhediske%2Femailspamprotection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhediske%2Femailspamprotection/lists"}