An AWS Lambda function to send an email via SES. Sends email to a set recipient with the content of the JSON input.
- Shells out to a Go binary to send the email.
- Policies to allow only one sender and receiver.
- Low line count.
For full setup and usage instructions, including an example with AWS API Gateway check out my Blog post
Input JSON:
{
"FromAddress": "from_address@example.com",
"ToAddress": "to_address@example.com",
"Subject": "Test Message",
"Message": "Test Body"
}
You need:
- An AWS account
- A Lambda function with the basic execution policy.
- SES set up with an email address and policy (permissons); an example set of permissions is in the policies/ses.json file.
- Your SES address configured in
config.json
(see config.example.json) - Build your own, or download the latest release from the releases section above.
- Add your config.json, zip and upload the zip to your Lambda.
You'll need Golang installed, then:
$ make build
There's nothing at all limiting the executable lambda-ses
to being used only in lambda. You can pass in the below JSON and AWS credentials come from ENV.
AWS_REGION
, AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
.
Standalone Input JSON:
{
"SenderAddress": "sender_address@example.com",
"FromAddress": "from_address@example.com",
"ToAddress": "to_address@example.com",
"Subject": "Test Message",
"Message": "Test Body"
}