This tool implements the Sparkpost API for incoming mail and the RT API to make it easy to use a managed email provider to receive and emails with Request Tracker.
See rt-mail.json.sample for an example configuration file.
The tool assumes that your "comment" address configured in RT is the same as the correspondence address with "-comment" suffixed to the local part.
To enable Amazon SES support, configure these environment variables:
RT-Mail Configuration:
RT_SES_SNS_TOPIC_ARN(required for SES) - The ARN of the SNS topic that receives SES notifications- Example:
arn:aws:sns:us-east-1:123456789012:ses-incoming-email - If not set, SES handler is disabled
- Example:
AWS SDK Configuration:
The AWS SDK requires credentials and region configuration. Use one of these methods:
-
Environment variables:
AWS_REGIONorAWS_DEFAULT_REGION- AWS region (required)- Example:
us-east-1 - Must match the region where your S3 bucket is located
- Example:
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY- AWS credentialsAWS_SESSION_TOKEN- For temporary credentials (optional)
-
AWS Profile:
AWS_PROFILE- Name of profile from~/.aws/credentials- Example:
defaultorproduction
- Example:
-
IAM Roles (recommended for AWS deployments):
- For EC2, ECS, EKS, or Lambda - attach an IAM role with S3 read permissions
- No environment variables needed
Required IAM Permissions:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["s3:GetObject"],
"Resource": "arn:aws:s3:::your-ses-bucket/*"
}]
}Mailgun, SparkPost, and SendGrid do not require environment variables. Configure webhook URLs in your provider's dashboard to point to the appropriate endpoints.
./rt-mail -listen=:8081 -config=rt-mail.json
There's a unique path for each email service provider API. For each of them prefix the path with the host and port that rt-mail is running on.
Configure Mailgun to forward mails to
/mg/mx/mime
Configure SparkPost to relay messages to
/spark/mx
Configure Sendgrid to relay messages, you'll need to enable full MIME emails
/sendgrid/mx
Configure SES to:
-
Store incoming emails in an S3 bucket using a receipt rule action
-
Publish notifications to an SNS topic
-
Subscribe the SNS topic to this webhook endpoint:
/ses
The SES handler verifies SNS message signatures for security and automatically confirms SNS subscriptions. Emails are fetched from S3 (up to 50MB) and posted to RT for each recipient.
Required: Set the RT_SES_SNS_TOPIC_ARN environment variable (see Environment Variables section below).
# Install development tools
make install-tools
# Run tests
make test
# Run linters
make lint
# Format code
make fmt
# Run all checks (fmt, vet, lint, test)
make check
# Build the binary
make build
# Run locally (requires rt-mail.json)
make runRun make help to see all available targets:
make build- Build the rt-mail binarymake test- Run all testsmake test-coverage- Run tests with coverage reportmake lint- Run lintersmake fmt- Format codemake check- Run all checks (recommended before committing)make install-tools- Install development tools (golangci-lint)make clean- Clean build artifacts
# Run all tests
make test
# Run tests with coverage
make test-coverage
# View HTML coverage report
make test-coverage-html
# Run tests for a specific package
go test -v ./rtThe project uses GitHub Actions for CI/CD:
- Test workflow (
.github/workflows/test.yml) - Runs tests, linting, and builds on every push/PR - Docker workflow (
.github/workflows/docker-publish.yml) - Builds and publishes Docker images
- support more providers
- Capture bounce events