emailers

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	application.BaseEmailer
}

Logger is a development emailer that logs emails instead of sending them

func NewLogger

func NewLogger(emails embed.FS, funcs template.FuncMap) *Logger

NewLogger creates a new Logger emailer for development

Example:

//go:embed all:emails
var emails embed.FS

emailer := emailers.NewLogger(emails, nil)

func (*Logger) Send

func (l *Logger) Send(to, subject, templateName string, data map[string]any) error

Send renders a template and logs it

type Resend

type Resend struct {
	application.BaseEmailer
	// contains filtered or unexported fields
}

Resend sends emails via the Resend API

func NewResend

func NewResend(emails embed.FS, apiKey, from string, funcs template.FuncMap, opts ...ResendOption) *Resend

NewResend creates a new Resend emailer

Example:

//go:embed all:emails
var emails embed.FS

emailer := emailers.NewResend(emails, apiKey, "noreply@example.com", nil)

func (*Resend) Send

func (r *Resend) Send(to, subject, templateName string, data map[string]any) error

Send renders a template and sends it via Resend

type ResendOption

type ResendOption func(*Resend)

ResendOption configures the Resend emailer.

func WithHTTPClient

func WithHTTPClient(client *http.Client) ResendOption

WithHTTPClient sets a custom HTTP client for the Resend emailer. Useful for testing — inject a client that routes to a test server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL