| { |
| "repository_url": "https://github.com/ronelsolomon/dev.git", |
| "owner": "ronelsolomon", |
| "name": "dev.git", |
| "extracted_at": "2026-03-02T22:49:34.034076", |
| "files": { |
| "index.html": { |
| "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title>Postmark Inbox Dashboard</title>\n <style>\n body { font-family: sans-serif; margin: 2rem; }\n h1 { color: #1d72b8; }\n .email { border-bottom: 1px solid #eee; margin-bottom: 1em; padding-bottom: 1em; }\n .subject { font-weight: bold; }\n .from { color: #888; }\n .body { margin-top: 0.5em; }\n </style>\n</head>\n<body>\n <h1>π₯ Postmark Inbox Dashboard</h1>\n <div id=\"inbox\"></div>\n <script>\n async function loadInbox() {\n const res = await fetch('/api/inbox');\n const emails = await res.json();\n const inboxDiv = document.getElementById('inbox');\n inboxDiv.innerHTML = emails.map(email => `\n <div class=\"email\">\n <div class=\"subject\">${email.subject}</div>\n <div class=\"from\">From: ${email.from} | ${new Date(email.receivedAt).toLocaleString()}</div>\n <div class=\"body\">${email.body.replace(/\\n/g, '<br>')}</div>\n </div>\n `).join('');\n }\n loadInbox();\n setInterval(loadInbox, 5000);\n </script>\n</body>\n</html>\n", |
| "size": 1209, |
| "language": "html" |
| }, |
| "README.md": { |
| "content": "# dev\n# π¨ Simple Email Inbox API\n\nA lightweight Flask-based email inbox system that accepts inbound emails via webhook and provides a JSON API to access messages.\n\n## Features\n\n- **Inbound Email Webhook**: Accepts POST requests with email data\n- **JSON Storage**: Persists emails in a simple JSON file\n- **REST API**: Provides endpoints to retrieve stored emails\n- **Basic Web Interface**: Simple HTML view to display inbox contents\n\n## Tech Stack\n\n- **Backend**: Python + Flask\n- **Storage**: JSON file (`inbox.json`)\n- **Frontend**: Basic HTML/CSS (via Jinja template)\n\n## Getting Started\n\n### Prerequisites\n- Python 3.7+\n- Flask\n\n### Installation\n1. Clone the repository:\n```bash\ngit clone https://github.com/yourusername/flask-email-inbox.git\ncd flask-email-inbox\n```\n\n2. Install dependencies:\n```bash\npip install flask\n```\n\n3. Run the application:\n```bash\npython app.py\n```\n\nThe server will start at `http://localhost:8000`\n\n## API Documentation\n\n### POST `/inbound`\nAccepts email data in JSON format\n\n**Example Request:**\n```json\n{\n \"From\": \"sender@example.com\",\n \"Subject\": \"Test Message\",\n \"TextBody\": \"Hello World!\"\n}\n```\n\n**Response:**\n- HTTP 200 (Empty response)\n\n### GET `/api/inbox`\nRetrieve all stored emails\n\n**Example Response:**\n```json\n[\n {\n \"from\": \"sender@example.com\",\n \"subject\": \"Test Message\",\n \"body\": \"Hello World!\",\n \"receivedAt\": \"2023-11-05T12:34:56.789Z\"\n }\n]\n```\n\n## Project Structure\n```\n.\nβββ app.py # Main application code\nβββ inbox.json # Email storage (auto-created)\nβββ templates/\nβ βββ index.html # Basic inbox view\nβββ README.md\n```\n\n## Deployment\n\n1. **Local Testing**:\n - Use ngrok to expose your local server:\n ```bash\n ngrok http 8000\n ```\n - Configure your email service provider to send webhooks to your ngrok URL\n\n2. **Production**:\n - Consider using:\n - Gunicorn/WSGI server\n - PostgreSQL/MongoDB for production storage\n - Environment variables for configuration\n - Docker containerization\n\n## Security Considerations\n\n1. Add authentication for the `/inbound` endpoint\n2. Implement request validation\n3. Use HTTPS in production\n4. Add rate limiting\n5. Consider replacing JSON file storage with a proper database\n\n## Example Usage\n\nView inbox in browser:\n```bash\nopen http://localhost:8000\n```\n\nQuery inbox via CLI:\n```bash\ncurl http://localhost:8000/api/inbox\n```\n\n## Troubleshooting\n\n**Common Issues:**\n- `inbox.json` not created: Ensure write permissions in project directory\n- CORS errors: Add proper CORS headers if using a frontend\n- Missing fields: Ensure POST requests include `From` and `Subject` fields\n\n## License\nMIT License\n\n---\n\n**Next Steps**:\n1. Add authentication middleware\n2. Implement email filtering/sorting\n3. Add pagination to API\n4. Support HTML email content\n5. Add attachment handling\n\nTo contribute, please fork the repository and submit a pull request.\n", |
| "size": 2913, |
| "language": "markdown" |
| }, |
| "app.py": { |
| "content": "from flask import Flask, request, jsonify, render_template\nimport json\nimport os\nfrom datetime import datetime\n\napp = Flask(__name__)\nINBOX_FILE = 'inbox.json'\n\ndef load_inbox():\n if os.path.exists(INBOX_FILE):\n with open(INBOX_FILE, 'r') as f:\n return json.load(f)\n return []\n\ndef save_inbox(inbox):\n with open(INBOX_FILE, 'w') as f:\n json.dump(inbox, f, indent=2)\n\n@app.route('/inbound', methods=['POST'])\ndef inbound():\n data = request.json\n if data and 'From' in data and 'Subject' in data:\n inbox = load_inbox()\n email = {\n 'from': data['From'],\n 'subject': data['Subject'],\n 'body': data.get('TextBody', ''),\n 'receivedAt': datetime.utcnow().isoformat()\n }\n inbox.insert(0, email)\n save_inbox(inbox)\n print(f\"Received: {email['subject']}\")\n return '', 200\n\n@app.route('/api/inbox')\ndef api_inbox():\n inbox = load_inbox()\n return jsonify(inbox)\n\n@app.route('/')\ndef index():\n return render_template('index.html')\n\nif __name__ == '__main__':\n app.run(debug=True, port=8000)\n\n", |
| "size": 1120, |
| "language": "python" |
| } |
| }, |
| "_cache_metadata": { |
| "url": "https://github.com/ronelsolomon/dev.git", |
| "content_type": "github", |
| "cached_at": "2026-03-02T22:49:34.034473", |
| "cache_key": "8f56b34b5833aed95e029da1d292b700" |
| } |
| } |