{"id":18966450,"url":"https://github.com/kael89/aws-lambda-mailer","last_synced_at":"2026-04-04T00:30:18.028Z","repository":{"id":51404017,"uuid":"252384881","full_name":"kael89/aws-lambda-mailer","owner":"kael89","description":"AWS Lambda function for serverless email sending","archived":false,"fork":false,"pushed_at":"2021-05-12T01:19:47.000Z","size":6,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-01T06:13:01.453Z","etag":null,"topics":["aws-lambda-node","aws-ses","nodemailer"],"latest_commit_sha":null,"homepage":"https://codinglicks.com/blog/serverless-emails-with-aws/","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/kael89.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":"2020-04-02T07:26:39.000Z","updated_at":"2020-06-23T09:57:12.000Z","dependencies_parsed_at":"2022-09-06T15:40:33.678Z","dependency_job_id":null,"html_url":"https://github.com/kael89/aws-lambda-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/kael89%2Faws-lambda-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kael89%2Faws-lambda-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kael89%2Faws-lambda-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kael89%2Faws-lambda-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kael89","download_url":"https://codeload.github.com/kael89/aws-lambda-mailer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239964515,"owners_count":19725952,"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":["aws-lambda-node","aws-ses","nodemailer"],"created_at":"2024-11-08T14:37:09.451Z","updated_at":"2026-04-04T00:30:17.962Z","avatar_url":"https://github.com/kael89.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aws-lambda-mailer\n\nAn [AWS Lambda](https://aws.amazon.com/lambda/) function using [nodemailer](https://nodemailer.com/) for serverless email sending.\n\nCheck [Serverless Emails with AWS](https://codinglicks.com/blog/serverless-emails-with-aws/) for a step-by-step guide on setting up a cloud-based email sending service.\n\n## Deployment\n\nYou can either manually upload a `.zip` file in your Lambda function, or use the `deploy.sh` script for automatic deployment:\n\n```\n./deploy.sh\n```\n\nIn order to use the script you will need a .`env` file under the project's root. An example:\n\n```bash\nAWS_REGION=ap-southeast-2\nAWS_FUNCTION_NAME=arn:aws:lambda:ap-southeast-2:999:function:sendEmail\n```\n\n⚠ If you follow the manual approach, you have to include both `index.js` and `node_modules/nodemailer/*` in the `.zip` file.\n\n## Usage\n\nTo invoke this function from a `Node.js` application, we must first add [aws-sdk](https://www.npmjs.com/package/aws-sdk) as a dependency:\n\n```bash\nnpm install aws-sdk\n```\n\nAn example implementation:\n\n```js\nconst Lambda = require('aws-sdk/clients/lambda');\n\nconst SEND_EMAIL_LAMBDA = 'myLambdaFunctionName'; // Your Lambda function name here\n\nconst lambda = new Lambda({\n  accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n  secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n  region: process.env.AWS_REGION,\n});\n\nconst sendEmail = (data, callback) =\u003e {\n  const { from, to, subject, text, html } = data;\n  const payload = { from, to, subject, text, html };\n\n  return lambda.invoke(\n    {\n      FunctionName: SEND_EMAIL_LAMBDA,\n      InvocationType: 'Event',\n      Payload: JSON.stringify(payload),\n    },\n    /**\n     * @function\n     * @param {?Error} error\n     * @param {?{ StatusCode, Payload }} results\n     */\n    (error, results) =\u003e callback(error, results),\n  );\n};\n\nmodule.exports = sendEmail;\n```\n\nWe also need to provide `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_REGION` in the execution environment.\n\n---\n\n✍ [Kostas Karvounis](https://github.com/kael89), 2019-2020\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkael89%2Faws-lambda-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkael89%2Faws-lambda-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkael89%2Faws-lambda-mailer/lists"}