GithubHelp home page GithubHelp logo

brainframe-me / aws-ses-serverless-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lakshmantgld/aws-ses-serverless-example

0.0 1.0 0.0 652 KB

AWS SES example in NodeJS using lambda

JavaScript 100.00%

aws-ses-serverless-example's Introduction

AWS-SES-Serverless-Example

serverless

This repo is an example of sending email using SES on Lambda invocation. It uses the AWS SES nodeJS SDK to send emails. Various parameters for sending email such as sourceEmail address, destination email address can be specified as body parameter for the Deployed APIGateway URL.

Technical Architecture:

Architecture diagram

Notes on AWS SES

  • If you are in SES sandbox, you have to verify both sender and receiver email addresses. But, If you have migrated out of SES sandbox, sender mail alone must be verified.
  • Best practice is to use IAM roles compared to hardcoding AWS credentials in application. For the IAM roles related to SES, take a look at the sesIAMRole branch.

Instructions to deploy:

  • Clone this repo:
git clone https://github.com/lakshmantgld/aws-ses-serverless-example.git
  • Install the dependencies:
cd aws-ses-serverless-example && yarn install or npm install
  • Set the AWS credentials as environment variables like described below:
AWS_SECRET_ACCESS_KEY=<secret-key>
AWS_REGION=<region>
AWS_ACCESS_KEY_ID=<access-key>

The above credentials are required for deploying the Lambda and APIGateway using serverless

  • Rename the config.copy.json to config.json.

  • Fill the above AWS credentials to config.json. As SES uses this credentials to send mail. Presently, SES supports only in US East, US West & EU(Ireland). So, If your region is not supported by SES, make sure you select the above regions and add it to the config.json.

  • Finally, deploy the app by running sls deploy -v.

  • Once the deployment completes, you can send mail by invoking the URL with the following parameters.

{
	"bccEmailAddresses": [],
	"ccEmailAddresses": [],
	"toEmailAddresses": ["****@gmail.com"],
	"bodyData": "Hey test message buddy!! From AWS SES",
	"bodyCharset": "UTF-8",
	"subjectdata": "AWS SES",
	"subjectCharset": "UTF-8",
	"sourceEmail": "****@gmail.com",
	"replyToAddresses": ["****@gmail.com"]
}

Here is the picture of similar invocation made in postman: Post parameters

aws-ses-serverless-example's People

Contributors

lakshmantgld avatar

Watchers

 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.