Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/askrella/aws-ses-mock

AWS SES simulator for e2e testing e.g. in pipelines :gear:
https://github.com/askrella/aws-ses-mock

aws aws-ses email emulator mock

Last synced: 3 days ago
JSON representation

AWS SES simulator for e2e testing e.g. in pipelines :gear:

Awesome Lists containing this project

README

        

# AWS SES Mock

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Docker](https://github.com/askrella/whatsapp-chatgpt/actions/workflows/docker.yml/badge.svg)
![Docker AMD64](https://img.shields.io/badge/docker-amd64-blue)
![Docker ARM64](https://img.shields.io/badge/docker-arm64-green)
![Build](https://img.shields.io/github/actions/workflow/status/askrella/aws-ses-mock/docker.yml?branch=master)

![Askrella](https://avatars.githubusercontent.com/u/77694724?s=100)

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.

# :gear: Getting Started

## Running the Docker Container

```bash
docker run -p 8081:8081 ghcr.io/askrella/aws-ses-mock:1.0.30
```

## Usage with NodeJS

Using the AWS SDK you can set the endpoint for SES manually by specifying the endpoint in your configuration:

```javascript
import AWS from 'aws-sdk'
const ses = new AWS.SES({ region: 'us-east-1', endpoint: 'http://localhost:8080' })
```

## Usage with Golang

Using the AWS SDK you can set the endpoint for SES manually by overriding the endpoint resolver:

```golang
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))
```

## Manual testing

The `POST` endpoint is available under `http://localhost:8080/` and should contain the raw JSON body used for SES messages:
```json
{
"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": "

Hello World!

This is the message body in HTML format.

"
}
},
"Subject": {
"Data": "Test email"
}
},
"Source": "[email protected]",
"ReplyToAddresses": [
"[email protected]"
]
}
```

## :test_tube: Running Tests

To run tests, run the following command

```bash
go test ./internal/*
```

# :wave: Contributors



* [Askrella Software Agency](askrella.de)
* [Steve](https://github.com/steve-hb) (Maintainer)
* [Navo](https://github.com/navopw) (Maintainer)

Feel free to open a new pull request with changes or create an issue here on GitHub! :)

# :warning: License
Distributed under the MIT License. See LICENSE.txt for more information.

# :handshake: Contact Us

In case you need professional support, feel free to contact us