Add Mailer — pluggable email delivery (#166)#180
Merged
Conversation
Phase 3 of the auth epic (#161); prerequisite for account recovery (#167). New winn_mailer module (the `Mailer` Winn module) with config-selected transports. - Mailer.send/3,4 -> {ok, transport} | {error, reason}; opts: from, reply_to, html. - :http transport posts to SendGrid v3 via hackney directly (winn_http doesn't expose request headers) — no new deps. Reads mailer.api_key / mailer.from / optional mailer.endpoint from Config. - :test transport captures messages in-process (captured/0, clear/0) so flows are assertable without sending mail. - SMTP deferred (would add a dependency) — noted in module + docs. - Mailer -> winn_mailer in winn_codegen_resolve. - 9 tests (capture, opts, ordering, clear, unknown/no transport, no-api-key, SendGrid payload shape text+html, e2e codegen resolution). Full suite 757 (only the pre-existing esqlite-NIF failure). docs/stdlib.md + CHANGELOG updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
16 tasks
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.
Summary
New
Mailermodule —Mailer.send/3,4— with a config-selected transport. Sub-issue E (#166) of the auth epic (#161) and the prerequisite for account recovery (#167). Branched offdevelop(no stacking).Transports
:httphackneydirectly (sincewinn_httpdoesn't expose request headers, needed forAuthorization: Bearer) — no new deps.:testMailer.captured/0/Mailer.clear/0) so flows are assertable without sending mail.SMTP is intentionally deferred — it would pull in a new dependency (e.g.
gen_smtp). Noted in the module and docs; use:httpfor now. (Satisfies the issue's "SMTP implemented or explicitly deferred with a note".)Testing
9 tests: capture, opts (from/html), ordering, clear, no-transport / unknown-transport errors, http-without-api-key error, SendGrid payload shape (text + html), and an e2e codegen-resolution test (
Mailer.sendthrough the compiler). Full suite 757, only the pre-existingwinn_sqlite_testsesqlite-NIF failure.Docs
docs/stdlib.mdgains aMailersection (transports table,send, test helpers); CHANGELOG updated.Part of #161. Closes #166 once merged. Unblocks #167 (email verification + password reset).
🤖 Generated with Claude Code