feat(service): add Mailtrap email service#1045
Open
tsokolovs wants to merge 3 commits into
Open
Conversation
Add a new notification service that sends transactional emails through the Mailtrap Email Sending API. The service uses only the Go standard library (net/http), so it introduces no new dependencies. It follows the conventions of the existing email services (sendgrid, mailgun): a New constructor, AddReceivers, a BodyFormat toggle (HTML by default, PlainText opt-out) and a Send method. Functional options cover the sender display name, bulk and sandbox hosts, a custom host, and a custom HTTP client. Includes table-driven unit tests (httptest-based) and a service README.
tsokolovs
force-pushed
the
feat/add-mailtrap-service
branch
from
July 6, 2026 07:25
cd0769c to
6c2527a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new notification service for Mailtrap, an email delivery platform for developers.
The service sends transactional emails through the Mailtrap Email API.
Motivation and Context
Mailtrap is a widely used email delivery/testing platform, but notify had no Mailtrap service — users had to fall back to the generic SMTP
mailservice. This adds first-class support alongside the other email providers (sendgrid,mailgun). It uses only the Go standard library (
net/http), so it introduces no new dependencies.How Has This Been Tested?
Table-driven unit tests (
service/mailtrap/mailtrap_test.go) usinghttptest.Serverto assert the request method, path,Api-Token/Content-Typeheaders, and JSON body for both HTML and plain-text sends, plus constructor/options/error-status cases (93% coverage). Verified locally withmake ci(golangci-lint clean, fullgo test -race ./...passing) andmake fmt.I've also tested both the Sandbox and live versions by sending them to myself.
Types of changes
Checklist: