Integrate "contact-us" functionality on single-page and static websites
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Sample Lambda Function with SES integration


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.


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 > /tmp/ses-deployment
Deploy it
aws cloudformation deploy --template-file /tmp/ses-deployment --stack-name send-email-stack --parameter-overrides RegionParameter=us-east-1 --capabilities CAPABILITY_IAM

Test it

curl -XPOST -i -H "fromEmail:" -H "subject: Hello World" -H "message: First Test"