Simple email AWS lambda function
Simple AWS lambda serverless function for sending emails using AWS SES
Run the following commands
$ npm install -g serverless # Install serverless globally
$ serverless config credentials --provider aws --key <AWS Access Key ID> --secret <AWS Secret Access Key> # Setting up default aws credentials
$ cd aws-serverless-messaging
$ npm install # Installing dependency
$ serverless deploy # Deploying serverless function to aws
By this command serverless deploy
you should be able to see the lambda function in your aws lambda dashboard and it should have returned an endpoint and api_key in your terminal keep these for now.
Setup the following variables into your aws lambda function
Run export MY_API_KEY=<any random key value for your lambda function>
Make a POST API call to the endpoint and send x-api-key into headers with the api_key value returned after deploy command. The API supports the following body parameters
For example -
{
"toAddresses": ["[email protected]"],
"textBody": "Hello",
"body": "Hello",
"subject": "Subject"
"sender": "[email protected]"
}
Built under MIT license.