Skip to main content

Production-ready Go email package

SMTP, templating, retries, rate limiting, connection pooling, async sending, middleware, DKIM signing, and provider adapters for SendGrid, Mailgun, and AWS SES — composable, well-tested, and dependency-light.

go get github.com/KARTIKrocks/goemail

SMTP Support

TLS / STARTTLS, authentication, and per-message context cancellation

Templating

Go html/text templates for HTML and plain-text email bodies

Attachments

Send files with proper MIME encoding and content types

Retry Logic

Configurable exponential backoff for transient SMTP failures

Rate Limiting

Built-in token-bucket limiter to avoid overwhelming providers

Connection Pooling

Reuse SMTP connections for high-throughput sending

Async Sending

Background queue with configurable workers and buffer size

Middleware Pipeline

Composable logging, metrics, recovery, and lifecycle hooks

Provider Adapters

SendGrid, Mailgun, and AWS SES via HTTP APIs (separate modules)

DKIM Signing

RSA-SHA256 / Ed25519 signing per RFC 6376 + 8463 — zero extra deps

Webhooks

Receive and normalize delivery events from any provider

Pluggable Logger

Bring your own logger — slog, zap, logrus, zerolog, anything

Mock Sender

Drop-in test double with assertions on sent messages

Header Safety

Automatic header-injection protection and address validation

Why goemail?

net/smtp gets you a connection and a DATA command. Everything past that — the parts that turn “I can send one email” into “I can run this in production” — is what goemail provides. It is not a replacement for net/smtp; the default Sender is built on top of it.

CapabilitygoemailRaw net/smtp
Retry with exponential backoffIncludedYou build it
Connection pooling for high throughputIncludedYou build it
Rate limitingIncludedYou build it
DKIM signing (RSA-SHA256 / Ed25519-SHA256)IncludedYou build it
HTML templates, attachments, batch sendingIncludedYou build it
Provider HTTP adapters (SendGrid, Mailgun, AWS SES)IncludedYou build it
Middleware (logging, metrics, hooks, recovery)IncludedYou build it
Header injection protection, address validationIncludedYou build it
Async sending with a buffered worker queueIncludedYou build it