{"id":23887197,"url":"https://github.com/mlomboglia/contact-fom-api","last_synced_at":"2026-05-16T09:32:39.379Z","repository":{"id":98777090,"uuid":"177981953","full_name":"mlomboglia/contact-fom-api","owner":"mlomboglia","description":"Serverless Contact Form API using API Gateway, Lambda, SES","archived":false,"fork":false,"pushed_at":"2019-04-10T16:56:07.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T04:27:22.959Z","etag":null,"topics":["api-gateway","aws","aws-lambda","serverless"],"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/mlomboglia.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":"2019-03-27T11:40:53.000Z","updated_at":"2019-04-10T16:56:08.000Z","dependencies_parsed_at":"2023-05-25T07:30:41.201Z","dependency_job_id":null,"html_url":"https://github.com/mlomboglia/contact-fom-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mlomboglia/contact-fom-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlomboglia%2Fcontact-fom-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlomboglia%2Fcontact-fom-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlomboglia%2Fcontact-fom-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlomboglia%2Fcontact-fom-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlomboglia","download_url":"https://codeload.github.com/mlomboglia/contact-fom-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlomboglia%2Fcontact-fom-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33096873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api-gateway","aws","aws-lambda","serverless"],"created_at":"2025-01-04T07:39:30.041Z","updated_at":"2026-05-16T09:32:39.363Z","avatar_url":"https://github.com/mlomboglia.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)\n![contributors](https://img.shields.io/badge/contributors-1-blue.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n![license](https://img.shields.io/badge/eslint-standard-yellowgreen.svg)\n\n\u003cimg src=\"https://raw.githubusercontent.com/adnanrahic/cdn/master/lambda-mailer/lambda-mailer.png\" alt=\"cover\" width=\"100%\"\u003e\n\n# Lambda Mailer\nSimple module for receiving an email from a contact form on your website.\n\n# Note!\n**Module needs Node.js version 8 or above.**\n\n## Usage\nConfiguration is rather simple. \n\n#### 1. Enable your email address in the AWS console -\u003e Simple Email Service\n#### 2. Install the module\n```bash\n$ npm i lambda-mailer\n```\n#### 3. `require()` it in your `handler.js`\n```js\n// define the options for your email and domain\nconst options = {\n  myEmail: process.env.EMAIL, // myEmail is the email address you enabled in AWS SES in the AWS Console\n  myDomain: process.env.DOMAIN // add the domain of your website or '*' if you want to accept requests from any domain\n}\n\n// initialize the function\nconst { sendJSON, sendFormEncoded } = require('lambda-mailer')(options)\n\n// Content-Type: application/json\n// The event.body needs to be a JSON object with 3 properties\n// - email\n// - name\n// - content\nmodule.exports.sendJSON = sendJSON\n\n// Content-Type: application/x-www-form-urlencoded\n// The event.body needs to a URI encoded string with 3 parameters\n// - email\n// - name\n// - content\nmodule.exports.sendFormEncoded = sendFormEncoded\n\n```\n#### 4. Hook it up to API Gateway in the `serverless.yml`\n```yaml\nservice: lambda-mailer\n\ncustom:\n  secrets: ${file(secrets.json)}\n\nprovider:\n  name: aws\n  runtime: nodejs8.10\n  stage: ${self:custom.secrets.NODE_ENV}\n  region: us-east-1\n  profile: ${self:custom.secrets.PROFILE}\n  environment: \n    NODE_ENV: ${self:custom.secrets.NODE_ENV}\n    EMAIL: ${self:custom.secrets.EMAIL}\n    DOMAIN: ${self:custom.secrets.DOMAIN}\n  iamRoleStatements:\n    - Effect: \"Allow\"\n      Action:\n        - \"ses:SendEmail\"\n      Resource: \"*\"\n\nfunctions:\n  sendJSON:\n    handler: handler.sendJSON\n    events:\n      - http:\n          path: email/send/json\n          method: post\n          cors: true\n  sendFormEncoded:\n    handler: handler.sendFormEncoded\n    events:\n      - http:\n          path: email/send/formencoded\n          method: post\n          cors: true\n```\n\n#### 5. Send an HTTP request to the API Gateway endpoint\n\nSend a POST request of the type JSON with the body as stated below. The sample below is with CURL.\n\n- request method: **POST**\n- request body type: **application/json**\n- request body: **{ email: String, name: String, content: String }**\n\n```bash\ncurl --header \"Content-Type: application/json\" \\\n  --request POST \\\n  --data '{\"email\":\"john.doe@email.com\",\"name\":\"John Doe\",\"content\":\"I need some help!\"}' \\\n  https://{id}.execute-api.{region}.amazonaws.com/{stage}/email/send/json\n```\n\n#### 6. Send a regular form POST request to the API Gateway endpoint\n\nSend a POST request using an HTML form. Sample below shows a simple HTML form.\n\n```html\n\u003cform action=\"https://{id}.execute-api.{region}.amazonaws.com/{stage}/dev/email/send/formencoded\" method=\"POST\"\u003e\n  \u003cinput type=\"text\" name=\"name\" required\u003e\n  \u003cinput type=\"email\" name=\"email\" required\u003e\n  \u003ctextarea name=\"content\" required\u003e\u003c/textarea\u003e\n\u003c/form\u003e\n```\n\nBy default the request will redirect back to the initial page the request was sent from. You can edit the `redirectUrl` by adding it as a query string parameter. Example below.\n\n```html\n\u003cform action=\"https://{id}.execute-api.{region}.amazonaws.com/{stage}/dev/email/send/formencoded?redirectUrl=https://someotherdomain.com\" method=\"POST\"\u003e\n  \u003cinput type=\"text\" name=\"name\" required\u003e\n  \u003cinput type=\"email\" name=\"email\" required\u003e\n  \u003ctextarea name=\"content\" required\u003e\u003c/textarea\u003e\n\u003c/form\u003e\n```\n\n---\n\nEnjoy using the module. Feel free to open issues or feature requests. :smile:","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlomboglia%2Fcontact-fom-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlomboglia%2Fcontact-fom-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlomboglia%2Fcontact-fom-api/lists"}