Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/garnertb/aws-lambda-send-ses-email
https://github.com/garnertb/aws-lambda-send-ses-email
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/garnertb/aws-lambda-send-ses-email
- Owner: garnertb
- License: mit
- Created: 2016-09-28T20:43:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-26T00:37:20.000Z (over 8 years ago)
- Last Synced: 2024-10-26T15:18:49.388Z (2 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aws-lambda-send-ses-email
An AWS Lambda function to send emails using Amazon SES.
The primary purpose of this function is to provide a server-side back-end for sending emails
from static websites.By using AWS Lambda, we can eliminate the need to host your (almost) static website on
EC2 instances.## Installation
1. Create an IAM Role for executing AWS Lambda functions.
2. Give your new IAM Role the following policy:```json
{
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Action" : [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource" : "arn:aws:logs:*:*:*"
},
{
"Effect" : "Allow",
"Action" : [
"cloudwatch:PutMetricData"
],
"Resource" : "*"
},
{
"Effect" : "Allow",
"Action" : [
"ses:SendEmail"
],
"Resource" : "*"
},
{
"Effect" : "Allow",
"Action" : [
"s3:GetObject"
],
"Resource" : "*"
}
]
}
```3. Create an S3 bucket to store the email template(s).
4. Create a template file (HTML or text file). A sample file is provided in the `Templates/` folder.
5. Upload the template file to your S3 bucket.
6. Download the latest release ZIP file.
7. Edit `config.js` providing your own details. Put your customized file back into the ZIP file.
8. Create an AWS Lambda function using your custom ZIP file as the source code.
## Usage
Call the Lambda function with any number of properties. The properties will be passed on to the
template file for substitution.### Notable Parameters
email: This parameter is required. It's used to populate the "Reply-To" field of the email.
name: This parameter is optional, but when omitted, the value from `email` will be used.
### Example 1
Template File:
```
Name: {{name}}
Email: {{email}}
{{message}}
```Input Parameters:
```
{
"name": "John",
"email": "[email protected]",
"message": "This is my message"
}
```## Credits
The following libraries are used:
* AWS SDK for NodeJS
* Markup.js - https://github.com/adammark/Markup.js/