feat(service): add MailKite email service - #1063
Open
bucabay wants to merge 1 commit into
Open
Conversation
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 MailKite, an email API for sending and receiving transactional mail.
The service sends messages through the MailKite Send API (
POST /v1/send) with a Bearer API key. It follows the shape of the Mailtrap service merged in #1045:New(apiKey, senderAddress, opts...),AddReceivers,BodyFormat(HTML|PlainText), and functional optionsWithSenderName,WithReplyTo,WithBaseURL,WithHTTPClient. Standard library only (net/http), so no new dependencies.Disclosure: I build MailKite. I am happy to maintain this service going forward (API changes, issues, follow-ups) and will watch for anything filed against
service/mailkite.Motivation and Context
Users of notify who send with MailKite currently have to go through the generic SMTP
mailservice. This adds first-class support alongside the other email providers (Amazon SES, Mailgun, Mailtrap, SendGrid) so the API key path works directly, with a reply-to option since notification replies usually belong somewhere other than the sender address.How Has This Been Tested?
service/mailkite/mailkite_test.gousinghttptest.Serverto assert the request method, path,Authorization: Bearer …/Content-Typeheaders, and the JSON body (from with and without a display name, multiple receivers, reply-to, HTML vs plain text), plus constructor/options, error-status and transport-error cases.go test -race -cover ./service/mailkite/...passes with 95.2% coverage.go build ./...andgo vet ./service/mailkite/...clean.golangci-lintv2.7.2 with this repo's.golangci.yaml: 0 issues.gofumpt,golines --shorten-comments -m 120andgofmtreport no changes.from,to[],subject,html/text,replyTo) is the same shape MailKite's own Go SDK sends to the production API; I have not wired a live send into the test suite, so the tests are all against the local mock server.Screenshots / Output (if appropriate):
Types of changes
Checklist: