https://github.com/biodranik/lambda-ses-send-email
Lambda function to send email using Amazon SES (Simple Email Service)
https://github.com/biodranik/lambda-ses-send-email
amazon aws email js lambda node send serverless ses
Last synced: 10 months ago
JSON representation
Lambda function to send email using Amazon SES (Simple Email Service)
- Host: GitHub
- URL: https://github.com/biodranik/lambda-ses-send-email
- Owner: biodranik
- License: mit
- Created: 2019-01-13T13:37:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-21T11:46:02.000Z (over 1 year ago)
- Last Synced: 2025-01-29T12:47:09.534Z (12 months ago)
- Topics: amazon, aws, email, js, lambda, node, send, serverless, ses
- Language: JavaScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serverless lambda to send email from HTML form
This lambda function sends email using Amazon SES (Simple Email Service).
## Installation and Setup
1. Install and setup [serverless](https://serverless.com/framework/docs/providers/aws/guide/installation/).
2. Verify 'From' and 'To' email addresses in [SES Console](https://console.aws.amazon.com/ses/home).
3. Deploy this lambda by `sls deploy` and remember it's POST endpoint: it should be used in your HTML form JS code.
4. Open Lambda function configuration console and add an environment variable. The name of variable should be in lowercase, and it is passed as a query *?source=* parameter to the POST URL above. The value should be in JSON and have three required parameters: *from*, *to* and *subject*. For example:
```json
{"from":"from@example.com","to":"to@example.com","subject":"My Static Website Contact Form","noheaders":false}
```
5. Use sample HTML form, CSS and JS from this repo on your static site. Use your POST URL in the code, like *`https://asd123qwe.execute-api.eu-west-1.amazonaws.com/dev/send?source=your_env_variable_name`*
Enjoy!
## Notes
- JS code sends all form inputs with *name=""* attribute.
- For better formatting, use *name="First Name" + name="Last Name"* or *name="Name"*, and *name="Email"* inside your `` tags.