Repo of the Day
synqronlabs/raven
Published: Oct 26, 2026
Open repository ↗ESMTP toolkit in go
Summary
Raven is a Go toolkit for building SMTP clients and servers and for handling SPF, DKIM, DMARC, and ARC. Its main design choice is to keep the SMTP envelope separate from RFC 5322 message content and stream message bodies, while retaining structured message-building helpers for applications that generate their own mail.
What it is useful for
It fits mail servers, gateways, submission agents, and delivery workers that need explicit control over SMTP transactions and want to make authentication or policy decisions in application code. A server session receives headers plus an io.Reader; a client can send a prebuilt .eml with SendRaw, and MIME content can be traversed incrementally instead of first becoming a large object graph.
Raven also provides typed protocol results, SASL PLAIN primitives with legacy LOGIN compatibility, and DNS resolvers that can expose DNSSEC authenticity signals. These packages support custom mail-processing paths while leaving policy decisions with the caller.
The main constraint is that DKIM and ARC verification operate on seekable io.ReaderAt message spools. The README recommends a temporary file as a bounded-memory spool for received messages; signing also needs its size. Eager secondary message representations are deprecated in favor of the streaming APIs, so existing code should check DEPRECATIONS.md.
How engineers can use it
Start by installing the module with the documented command:
go get github.com/synqronlabs/raven
For outbound mail, build a message with mail.NewMailBuilder(), connect through client.NewDialer, and call Send. The example enables StartTLS and uses Quit to close the connection. For an existing message, open the .eml, construct a mail.Envelope with the SMTP MAIL FROM and RCPT TO addresses, and pass the file to client.SendRaw.
In the server example, implement server.Backend and server.Session: decide what Mail and Rcpt accept, then consume the io.Reader passed to Data before returning. Configure server.NewServer with a domain and listen address. RFC 6531 support is opt-in through EnableSMTPUTF8.
For authentication, create a DNSSEC-aware resolver with dns.NewResolver, call spf.Verify, and feed its results into dmarc.Verify. Verify DKIM with (&dkim.Verifier{Resolver: resolver}).VerifyReader(ctx, messageSpool). To sign a spooled message, use dkim.Signer.SignReader(spool, info.Size()), rewind the spool, and prepend the returned header lines with mail.NewHeaderPrependedReader before SendRaw.
The README includes code examples, a package map, and benchmark methodology. Its reported benchmark figures are in-memory results that exclude network, disk, and external DNS latency, so they should not be read as end-to-end mail-system throughput.