ghashange/sendgrid-mock
SendGrid-Mock serves as a simple server mocking the sendgrid-apis for development purposes.
500K+
SendGrid-Mock serves as a simple server mocking the sendgrid-apis for development purposes.
Send mails POST /v3/mail/send
Retrieve sent mails GET /api/mails
GET /api/mails?to=email@address.com
GET /api/mails?subject=The subject
(exact match)GET /api/mails?subject=%subject%
(contains)GET /api/mails?dateTimeSince=2020-12-06T10:00:00Z
(
ISO-8601 format)Delete sent mails DELETE /api/mails
DELETE /api/mails?to=email@address.com
Basic authentication support: Add basic authentication credentials by specifying environment variable AUTHENTICATION
to the following format: user1:passwordForUser1;user2:passwordForUser2
. This applies only to the static content.
API key support: Add API key authentication by specifying environment variable API_KEY
. This applies only to the API endpoints.
Request rate limiting: Both the actual SendGrid API server as well as the SSL server can be rate limited by specifying environment variables:
RATE_LIMIT_ENABLED
: true
or false
(default)RATE_LIMIT_WINDOW_IN_MS
: The time window in milliseconds (default: 60000
)RATE_LIMIT_MAX_REQUESTS
: The maximum number of requests allowed in the time window (default: 100
)SSL_RATE_LIMIT_ENABLED
: true
or false
(default)SSL_RATE_LIMIT_WINDOW_IN_MS
: The time window in milliseconds (default: 60000
)SSL_RATE_LIMIT_MAX_REQUESTS
: The maximum number of requests allowed in the time window (default: 100
)By default, all emails older than 24 hours will be deleted. This can be configured using environment variable MAIL_HISTORY_DURATION
which uses ISO-8601 Duration format such as 'PT24H'.
Event support: Add basic event support by specifying the environment variable EVENT_DELIVERY_URL
. When set, delivered events will be sent to the specified webhook URL when an email is sent.
The SendGrid-Mock server and the UI are both contained in the same docker-image which you can pull from Docker Hub and start it via:
docker run -it -p 3000:3000 -e "API_KEY=sendgrid-api-key" ghashange/sendgrid-mock:1.12.0
Some prepared HTTP calls can be found here.
The UI can be accessed at http://localhost:3000.
SendGrid-Mock also supports SSL using Let's Encrypt. To enable SSL, run it as follows:
docker run -it -p 3000:3000 -e "API_KEY=sendgrid-api-key" -e "CERT_DOMAINNAMES=[your-domain-name]" -e "CERT_EMAIL=[your-email-address]" ghashange/sendgrid-mock:1.12.0
docker pull ghashange/sendgrid-mock