{"id":17480270,"url":"https://github.com/integeralex/mockemailsending","last_synced_at":"2025-03-28T12:43:55.202Z","repository":{"id":254904678,"uuid":"847877836","full_name":"IntegerAlex/mockEmailSending","owner":"IntegerAlex","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-28T08:07:24.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T19:49:22.687Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://email-v2ndqtpkjq-uc.a.run.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IntegerAlex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-08-26T18:06:33.000Z","updated_at":"2024-08-28T08:07:28.000Z","dependencies_parsed_at":"2024-08-26T23:07:38.638Z","dependency_job_id":null,"html_url":"https://github.com/IntegerAlex/mockEmailSending","commit_stats":null,"previous_names":["integeralex/mockemailsending"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntegerAlex%2FmockEmailSending","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntegerAlex%2FmockEmailSending/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntegerAlex%2FmockEmailSending/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntegerAlex%2FmockEmailSending/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IntegerAlex","download_url":"https://codeload.github.com/IntegerAlex/mockEmailSending/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246034276,"owners_count":20712851,"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","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":[],"created_at":"2024-10-18T21:43:13.509Z","updated_at":"2025-03-28T12:43:55.181Z","avatar_url":"https://github.com/IntegerAlex.png","language":"TypeScript","readme":"# Email Sending Service\n\n[![Time Spent On Project](https://wakatime.com/badge/user/018e6a20-9532-42e6-b0cd-906f7586aac9/project/2cba7168-90d3-47cd-9de2-8a0039bb7fe5.svg)](https://wakatime.com/badge/user/018e6a20-9532-42e6-b0cd-906f7586aac9/project/2cba7168-90d3-47cd-9de2-8a0039bb7fe5)\n\nThis project is a simple email sending service using Express and TypeScript. It demonstrates handling email sending with retry logic, status tracking, and providing a basic admin panel for monitoring the status of sent emails.\n\n## Tech-Stack\n    - Node.js\n    - Express\n    - TypeScript\n    - HTML + CSS + HTMX (for frontend)\n    - CloudRun (for deployment)\n\n\n## How It Works\n\nThe email sending service handles email delivery through two providers, providerOne and providerTwo, with a retry mechanism for each provider.\n\n1.Email Sending Process:\n\n - Provider One: Initially, the service checks if the email is in the providerOne array. If found, it attempts to send the email. If the email sending fails, it retries up to three times, with an exponential backoff strategy (i.e., doubling the delay between retries). Each retry updates the status in the statusTracker object.\n - Provider Two: If the email is not handled by providerOne, the service then checks providerTwo. Similar to providerOne, it retries sending the email up to six times if it fails, with an exponential backoff delay.\nStatus Tracking:\n\nThe statusTracker object maintains the status of each email attempt. It records which provider was used, the number of retries, and whether the email was successfully sent or failed.\nFrontend Integration:\n\nAn admin panel allows users to submit email requests and view the status of all sent emails. The panel updates every 20 seconds with the latest email statuses retrieved from the backend.\n\n## Project Structure\n\nsrc/index.ts - Main Express application with routes for sending emails and retrieving status.\nsrc/mail.ts - Contains the logic for sending emails and retrying with different providers.\nviews/index.html - Frontend HTML for the admin panel.\n- [Tutorial](https://youtu.be/a5VeOa7Rbxw)\n- [live link](https://email-v2ndqtpkjq-uc.a.run.app)\n\n## Setup\n\n### Prerequisites\n - Node.js (\u003e=18.x)\n - npm or yarn\n - TypeScript\n\n### Installation\n\nClone the Repository\n\n```bash\ngit clone https://github.com/IntegerAlex/mockEmailSending\ncd mockEmailSending\n```\n\nInstall Dependencies\n\n`npm install`\n\n\nRunning the Application\nStart the server with:\n\n```bash\nnpm run build\nnpm run start\n```\n\nThe server will be available at http://localhost:3000.\n\n### Endpoints\n\n`POST` /sendMail: Send an email.\n\nRequest Body:\njson\nCopy code\n{ \"client\": \"user@example.com\" }\nResponse: JSON object with the status of the email.\n\n`GET` /getStatusTracker: Retrieve the status of all sent emails.\nResponse: HTML with the status of each email.\n\nFrontend\nThe admin panel is served at the root URL (/). It provides:\n\nA form to send emails.\nA section to display the status of all sent emails.\n\nNotes\n\nEmail Providers: The current implementation uses mock providers. Replace with actual email provider logic as needed.\n\nLogging: Detailed logs are included for debugging and tracing email sending and retry logic.\nContributing\n\nLicense\nThis project is licensed under the MIT License. See the LICENSE file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegeralex%2Fmockemailsending","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintegeralex%2Fmockemailsending","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegeralex%2Fmockemailsending/lists"}