Skip to content

Latest commit

 

History

History
116 lines (87 loc) · 3.42 KB

README.md

File metadata and controls

116 lines (87 loc) · 3.42 KB

AWS SES Mock

License: MIT Docker Docker AMD64 Docker ARM64 Build

Askrella

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.

⚙️ Getting Started

Running the Docker Container

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:

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:

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:

{
    "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]"
    ]
}

🧪 Running Tests

To run tests, run the following command

  go test ./internal/*

👋 Contributors

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

⚠️ License

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

🤝 Contact Us

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