{"id":28641034,"url":"https://github.com/dotcs/aws-lambda-ses-recaptcha-simple-mailer","last_synced_at":"2025-06-12T20:36:44.353Z","repository":{"id":14316959,"uuid":"73631161","full_name":"dotcs/aws-lambda-ses-recaptcha-simple-mailer","owner":"dotcs","description":"Provides a simple mail backend via AWS Lambda that uses AWS SES for sending mails and is secured via reCAPTCHA v2.","archived":false,"fork":false,"pushed_at":"2022-12-08T23:00:46.000Z","size":301,"stargazers_count":6,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-14T12:31:46.082Z","etag":null,"topics":[],"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/dotcs.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":"2016-11-13T17:24:14.000Z","updated_at":"2022-11-11T15:55:29.000Z","dependencies_parsed_at":"2023-01-13T17:53:11.335Z","dependency_job_id":null,"html_url":"https://github.com/dotcs/aws-lambda-ses-recaptcha-simple-mailer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dotcs/aws-lambda-ses-recaptcha-simple-mailer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcs%2Faws-lambda-ses-recaptcha-simple-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcs%2Faws-lambda-ses-recaptcha-simple-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcs%2Faws-lambda-ses-recaptcha-simple-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcs%2Faws-lambda-ses-recaptcha-simple-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotcs","download_url":"https://codeload.github.com/dotcs/aws-lambda-ses-recaptcha-simple-mailer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcs%2Faws-lambda-ses-recaptcha-simple-mailer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259522797,"owners_count":22870556,"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":"2025-06-12T20:36:42.577Z","updated_at":"2025-06-12T20:36:44.342Z","avatar_url":"https://github.com/dotcs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aws-lambda-ses-recaptcha-simple-mailer\n\nProvides a simple mail backend via AWS Lambda that uses AWS SES for sending mails and is secured via reCAPTCHA v2.\n\n## Installation\n\nInstall all necessary dependencies via `npm install`.\nMake sure to install the correct nodejs version, which is listed in `conda-requirements.txt`.\n\n```bash\n$ conda create -p ./.env --file conda-requirements.txt\n$ conda activate ./.env\n\n$ node --version\nv10.13.0\n$ npm --version\n6.4.1\n```\nThis module has been tested with the AWS \"Node.js 10.x\" runtime.\n\n## Usage\n\nThe following variables need to be set in the AWS Lamdba function definition:\n\n```bash\nCAPTCHA_PRIVATE_KEY=\"YOUR_KEY_HERE\"\nRECEIVER_MAIL=\"some.mail@domain.com\"       # can be multiple receivers, separate by comma\nRECEIVER_MAIL_BCC=\"some.mail@domain.com\"   # can be multiple BCC receivers, separate by comma\nSENDER_MAIL=\"some.mail@domain.com\"\nSES_ACCESS_KEY_ID=\"YOUR_KEY_HERE\"\nSES_REGION=\"eu-west-1\"                     # or any other region\nSES_SECRET_ACCESSKEY=\"YOUR_KEY_HERE\"\n```\n\nConfiguration of environment variables in AWS:\n\n![AWS Lambda Environment Variables](./assets/aws-lambda-envs.png)\n\nRun `npm run build` in order to create a zip file in the `build` directory.\nThis file contains the script and all necessary modules from the `node_modules` folder.\n\nThis script has been designed to work behind a AWS Gateway's POST method. \n\n\n![AWS Designer View](./assets/aws-designer.png)\n\n![AWS API Gateway Configuration View](./assets/aws-trigger-api-gateway.png)\n\n\nThe API Gateway requires the client to send three properties via POST method,\nwith a properly set header `Content-Type: 'application/json'`:\n\n```\n{\n  \"subject\": string,\n  \"message\": string,\n  \"g-recaptcha-response\": string\n}\n```\n\n`subject` and `message` are both free form texts, that are used for the mail subject and its message body. \n`g-recaptcha-response` must provide the token provided by reCAPTCHA for the request.\n\nThe script will then test the token against reCAPTCHA's backend by performing an HTTP request. \nIf everything worked out the response will have status code 201 with an empty response body.\n\nIn case of an error it will give one of the following responses:\n\n| Response status  | Description  | Respnose HTTP status code  |\n|---|---|---|\n| CAPTCHA_INVALID  | Given captcha code was invalid  | 400   |\n| CAPTCHA_FAILED  | Problem when quering the reCAPTCHA API | 500  |\n| OTHER | Problem when querying AWS SES | 500  |\n\n\n## Tests\n\nWhile this repo does not provide a full test suite, you can test the [reCAPTCHA v2 implementation by using their test keys](https://developers.google.com/recaptcha/docs/faq#id-like-to-run-automated-tests-with-recaptcha-v2-what-should-i-do).\n\n## Contribution\n\nFeel free to contribute to this repository, but always make sure to exclude your `env.js` file as all private keys are \nstored in this file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotcs%2Faws-lambda-ses-recaptcha-simple-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotcs%2Faws-lambda-ses-recaptcha-simple-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotcs%2Faws-lambda-ses-recaptcha-simple-mailer/lists"}