GithubHelp home page GithubHelp logo

vbudilov / serverless-email-for-single-page-sites Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 5.0 28 KB

Integrate "contact-us" functionality on single-page and static websites

Home Page: http://budilov.com

Kotlin 100.00%
ses lambda lambda-role api-gateway email serverless serverless-framework aws-ses aws kotlin

serverless-email-for-single-page-sites's Introduction

Sample Lambda Function with SES integration

Introduction

This simple code is a deployable example of a lambda/ses integration. It's using SAM for deployment purposes, so it's a matter of running a couple of commands in order for you to get started quickly and efficiently. Architecture

Who would want to use this?

If you decided to host a static website on S3 but still want people to send you emails through your contact page, this might be a really nice solution for you. The combination of S3, API Gateway, Lambda, & SES covers the basis for a lot of website owners.

Setup

In order for this to work, you need to authorize the receiver (DESTINATION_EMAIL) of your setup. Otherwise SES will throw an exception saying that the destination email isn't verified. More info here: Verifying Email Addresses in Amazon SES

Running the cloudformation scripts will provision the needed resources, including API Gateway and Lambda, which might incur some costs

Get this repo and build it with maven

mvn package
Build your code
mvn package
Package it
aws cloudformation package --template-file sam.yaml --s3-bucket code.bucket.name > /tmp/ses-deployment
Deploy it
aws cloudformation deploy --template-file /tmp/ses-deployment --stack-name send-email-stack --parameter-overrides RegionParameter=us-east-1 [email protected] --capabilities CAPABILITY_IAM

Test it

curl -XPOST -i -H "fromEmail: [email protected]" -H "subject: Hello World" -H "message: First Test"  https://aaaaaaaa.execute-api.us-east-1.amazonaws.com/Prod/email

serverless-email-for-single-page-sites's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.