Giter Club home page Giter Club logo

aws-lambda-send-ses-email's Introduction

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:
{
    "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" : "*"
        }
    ]
}
  1. Create an S3 bucket to store the email template(s).

  2. Create a template file (HTML or text file). A sample file is provided in the Templates/ folder.

  3. Upload the template file to your S3 bucket.

  4. Download the latest release ZIP file.

  5. Edit config.js providing your own details. Put your customized file back into the ZIP file.

  6. 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:

<p>
  Name: {{name}}<br />
  Email: {{email}}<br />
</p>
<p>{{message}}</p>

Input Parameters:

{
  "name": "John",
  "email": "[email protected]",
  "message": "This is my message"
}

Credits

The following libraries are used:

aws-lambda-send-ses-email's People

Contributors

mwhouser avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.