mailer

package
v1.11.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapturingMailer added in v1.8.0

type CapturingMailer struct {
	// contains filtered or unexported fields
}

CapturingMailer is a domain.Mailer implementation that captures sent OTP codes. Use in integration/smoke tests to inspect OTP codes without a real SMTP server.

func NewCapturingMailer added in v1.8.0

func NewCapturingMailer() *CapturingMailer

NewCapturingMailer constructs a CapturingMailer.

func (*CapturingMailer) OTPFor added in v1.8.0

func (m *CapturingMailer) OTPFor(email string) string

OTPFor returns the most recently sent OTP code for the given email. Returns an empty string if no OTP has been sent.

func (*CapturingMailer) SendOTP added in v1.8.0

func (m *CapturingMailer) SendOTP(_ context.Context, email, code string) error

SendOTP captures the OTP code for later retrieval in tests.

type NoopMailer

type NoopMailer struct{}

NoopMailer is a domain.Mailer implementation that discards all emails. Use in unit tests and local development.

func NewNoopMailer

func NewNoopMailer() *NoopMailer

NewNoopMailer constructs a NoopMailer.

func (*NoopMailer) SendOTP

func (n *NoopMailer) SendOTP(_ context.Context, _, _ string) error

SendOTP is a no-op implementation of domain.Mailer.

type SMTPMailer

type SMTPMailer struct {
	// contains filtered or unexported fields
}

SMTPMailer implements domain.Mailer via net/smtp.

func NewSMTPMailer

func NewSMTPMailer(host string, port int, username, password, from string) (*SMTPMailer, error)

NewSMTPMailer constructs an SMTPMailer. Returns an error if required fields are empty.

func (*SMTPMailer) SendOTP

func (m *SMTPMailer) SendOTP(ctx context.Context, to, code string) error

SendOTP sends the OTP code to the recipient via SMTP.

Jump to

Keyboard shortcuts

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