Giter Site home page Giter Site logo

serverless-contact-form's Introduction

Serverless Email Contact Form

Send contact form emails using Serverless with AWS Lambda and AWS SES

Prerequisites

You will need:

  • An AWS account
  • An IAM account with privileges to send emails using SES
  • An email address that's been verified in SES. This is the email you'll be sending your emails to
  • The AWS CLI installed on your local machine, configured to your IAM credentials
  • serverless installed on your local machine

Installation

  1. Clone this repository to your local machine, and change to that directory
  2. Change the values in handler.js in the ses.sendEmail() function, set the ToAddresses and Source to the email you've verified in SES. You can have multiple ToAddresses, as long as they're all verified in SES
  3. You can test the function locally by running serverless invoke local --function sendForm --path event.json. This will run the function using the data in event.json
  4. Run serverless deploy to upload to AWS Lambda
  5. You can test the function through Lambda by running serverless invoke --function sendForm --path event.json. This will run the function using the data in event.json
  6. A very basic contact form is included in the repository, index.html, replace API_GATEWAY_URL with the gateway URL that serverless displays in the console after you've deployed it. You can use this to test that the form works from a webpage. Uncomment the redirectUrl field if you want to redirect to another URL after a successful form submission.
  7. You should be able to see the results of each form submission in AWS CloudWatch > Log Groups > /aws/lambda/contact-form-prod-sendForm (when you're in the AWS Console, make sure you're in the same region that you set in serverless.yml, otherwise the logs may not show up in CloudWatch)

serverless-contact-form's People

Contributors

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