newsmail.mp4
A lightweight full‑stack project that fetches news and sends summaries via email. The repository contains a Python backend that handles news retrieval and mail sending, and a Vite-powered frontend for UI.
Repository structure
backend/: Python backend (news fetcher, mail sender, API)main.py— backend entrypoint / APInews.py— news fetching logicsend_mail.py— mail sending utilitiessystem_prompt.py,chat.py,check_json.py— helper scriptsenv.bat,run.bat,freeze.bat— Windows helper scriptsrequirements.txt— Python dependencies
frontend/: Vite + React frontendsrc/— React source files (App.jsx,main.jsx, components)package.json,vite.config.js— frontend config
README.md— this file
Features
- Periodically fetches latest news items (backend)
- Composes and sends email summaries (SMTP)
- Simple React frontend to view/send news summaries
Quickstart (Windows)
-
Backend
- Open a terminal and create a virtual environment (recommended): ```powershell python -m venv .venv .\\.venv\\Scripts\\Activate.ps1 cd backend pip install -r requirements.txt ``` - Configure environment variables. See [backend/env.bat](backend/env.bat) for an example of the variables used by the backend (SMTP credentials, recipient address, API keys, etc.). You can copy and edit that file or set variables in your environment. - Start the backend using the bundled script: ```powershell ..\\backend\\run.bat ``` Or run the app directly (if it uses `uvicorn`): ```powershell uvicorn main:app --reload --app-dir backend ``` -
Frontend
- From the repository root: ```powershell cd frontend npm install npm run dev ``` - Open the local dev URL shown by Vite (commonly http://localhost:5173).
Configuration
- Mail and API settings: edit backend/env.bat or set environment variables directly. The backend reads SMTP host, port, username, password, and any news API keys from the environment.
- Frontend settings (if any) live in
frontend/and can be adjusted invite.config.jsor your environment.
Development notes
- Use
backend/freeze.batto generate arequirements.txtsnapshot when adding Python packages. - The backend exposes endpoints for fetching news and triggering mail sends; check
backend/main.pyfor routes and payloads.
Testing & Running
- Manual test: run the backend, then use the frontend UI to trigger a mail send or call the backend endpoints directly via
curlor Postman.
Contributing
- Fork the repo, create a feature branch, and open a pull request with your changes. Include tests or manual steps to validate the change.
License
This project is available under the MIT License. See LICENSE if present or add one to clarify licensing.
If you want, I can also:
- Add a sample
.envfile with the expected environment variables. - Add step-by-step Windows screenshots or CI workflow for deployment.