AWS Email Sender is a serverless solution for sending emails using AWS Simple Email Service (SES) from a Lambda function. It's designed to handle contact form submissions, extracting user data and forwarding it via email. This solution is perfect for serverless websites or applications requiring a straightforward way to handle email notifications.
- AWS Account
- Verified email address in Amazon SES
- Node.js and npm/yarn installed (for local setup)
Ensure you have a verified email address in Amazon SES. This email will be used as the sender and recipient for the contact form submissions. To verify an email address:
- Navigate to the SES console.
- In the Identity Management section, choose Email Addresses.
- Click Verify a New Email Address and follow the prompts.
- Clone this repository to your local machine.
- Install dependencies with
npm install
oryarn
. - Zip the contents of the repository, including
node_modules
. - Create a new Lambda function in the AWS Console and upload the zip file.
- Set the Lambda function's execution role to have
AmazonSESFullAccess
permissions. - Configure a trigger for the Lambda function (e.g., API Gateway).
For applications requiring an HTTP endpoint:
- Create a new API in AWS API Gateway.
- Create a new resource and method (POST) linked to your Lambda function.
- Deploy the API and note the endpoint URL.
To send an email, make a POST
request to your Lambda function (or API Gateway endpoint) with the following JSON body:
{
"firstName": "Jane",
"lastName": "Doe",
"company": "Example Inc.",
"email": "[email protected]",
"message": "This is a test message."
}
The Lambda function will parse the input and send an email using Amazon SES.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the project.
- Create your feature branch (git checkout -b feature/AmazingFeature).
- Commit your changes (git commit -m 'Add some AmazingFeature').
- Push to the branch (git push origin feature/AmazingFeature).
- Open a pull request.
Distributed under the MIT License. See LICENSE for more information.
Twitter - @olwiba