We created this project as a new version of aws-ses-local, which doesn't seem to be maintained for a few years. Our goal is to provide more features, small containers and be more accurate than the alternatives.
docker run -p 8081:8081 ghcr.io/askrella/aws-ses-mock:1.0.30
Using the AWS SDK you can set the endpoint for SES manually by specifying the endpoint in your configuration:
import AWS from 'aws-sdk'
const ses = new AWS.SES({ region: 'us-east-1', endpoint: 'http://localhost:8080' })
Using the AWS SDK you can set the endpoint for SES manually by overriding the endpoint resolver:
customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
if overrideEndpoint, exists := os.LookupEnv("OVERRIDE_SES_ENDPOINT"); exists {
return aws.Endpoint{
PartitionID: "aws",
URL: overrideEndpoint,
SigningRegion: "eu-central-1",
}, nil
}
return aws.Endpoint{}, &aws.EndpointNotFoundError{}
})
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("eu-central-1"), config.WithEndpointResolverWithOptions(customResolver))
The POST
endpoint is available under http://localhost:8080/
and should contain the raw JSON body used for SES messages:
{
"Action": "SendEmail",
"Destination": {
"ToAddresses": [
"[email protected]"
],
"CcAddresses": [
"[email protected]"
],
"BccAddresses": [
"[email protected]"
]
},
"Message": {
"Body": {
"Text": {
"Data": "This is the message body in plain text format."
},
"Html": {
"Data": "<html><body><h1>Hello World!</h1><p>This is the message body in HTML format.</p></body></html>"
}
},
"Subject": {
"Data": "Test email"
}
},
"Source": "[email protected]",
"ReplyToAddresses": [
"[email protected]"
]
}
To run tests, run the following command
go test ./internal/*
Feel free to open a new pull request with changes or create an issue here on GitHub! :)
Distributed under the MIT License. See LICENSE.txt for more information.
In case you need professional support, feel free to contact us