{"id":26448479,"url":"https://github.com/decimoseptimo/rest-mailer","last_synced_at":"2026-04-06T08:31:10.169Z","repository":{"id":57354918,"uuid":"131661127","full_name":"decimoseptimo/REST-mailer","owner":"decimoseptimo","description":"A REST API for sending mails in NodeJS/Express using Mailgun as ESP.","archived":false,"fork":false,"pushed_at":"2019-03-27T23:44:10.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T13:36:07.061Z","etag":null,"topics":["express","jamstack","mailgun","nodejs","rest"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/decimoseptimo.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}},"created_at":"2018-05-01T00:41:19.000Z","updated_at":"2019-03-27T23:44:11.000Z","dependencies_parsed_at":"2022-09-26T16:31:36.430Z","dependency_job_id":null,"html_url":"https://github.com/decimoseptimo/REST-mailer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decimoseptimo%2FREST-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decimoseptimo%2FREST-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decimoseptimo%2FREST-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decimoseptimo%2FREST-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/decimoseptimo","download_url":"https://codeload.github.com/decimoseptimo/REST-mailer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244240930,"owners_count":20421553,"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":["express","jamstack","mailgun","nodejs","rest"],"created_at":"2025-03-18T14:34:38.917Z","updated_at":"2025-12-31T00:15:43.735Z","avatar_url":"https://github.com/decimoseptimo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REST mailer\n\nA REST API for sending mails in NodeJS/Express using Mailgun as ESP.\n\nSpecifically, this is a backend service that handles the actual mail sending of a contact form in a static website as part of a JAMstack architecture.\n\n## Installation\n- `npm install`\n- Review server config in `server.js`\n- Setup configuration file in `config/mail-config.js`.\\\n  `config.example/` is provided as example.\n- `npm start`\n\n## API\n##### Send Mail\n* POST /api/v1/contact-form\n\n_Model_\n```js\ncontact-form {\n    name (not_null),\n    email (not_null, email),\n    subject (not_null),\n}\n```\n\n## Advanced\n##### Multiple forms\nCreating another form is easy, just clone an existing route. From there you can set the endpoint URL, configuration file, and validate input.\n\n```\nrouter.post('/new-endpoint', function (req, res){\n    const config = require('./config/new-config')\n    const {name, email, message} = req.body\n\n    if (name \u0026\u0026 email \u0026\u0026 message){\n        sendMail(res, config.mailgun, config.mail(name, email, message))\n    }\n    else{\n        error = {error: 'Missing parameters. Name, email, \u0026 message are required.'}\n        console.log(error)\n        res.status(400)\n        res.send(JSON.stringify(error))\n    }\n})\n```\n\n##### Different domains\nIf POSTing from a different domain, add the domain(s) to the `allowedOrigins` array. This is in compliance with [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) policy. Otherwise the browser will fail to load the endpoint and its console may show `No 'Access-Control-Allow-Origin' header is present ` errors.\n\n## Testing\nTo test from localhost you can issue the following commands in the terminal.\n\n##### Root entrypoint\n```\ncurl http://localhost:9980/api/v1\n```\n\nReturns the confirmation string `/`\n\n##### Contact form entrypoint\n```\ncurl -d \"name=value1\u0026email=value2@example.com\u0026message=value3\" -X POST http://localhost:9980/api/v1/contact-form\n```\nReturns a JSON string returned by the mailgun service. It contains a success or failure message.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecimoseptimo%2Frest-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdecimoseptimo%2Frest-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecimoseptimo%2Frest-mailer/lists"}