mail

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderSMTP   = "smtp"
	ProviderResend = "resend"
	ProviderSES    = "ses"
	ProviderLog    = "log"
)

Variables

This section is empty.

Functions

func BuildMIME

func BuildMIME(from, to, subject, textBody, htmlBody string) []byte

BuildMIME builds a simple multipart/alternative body.

func FormatAddress

func FormatAddress(from string) (display, email string)

FormatAddress parses "Name <email>" or bare email for SMTP MAIL FROM / headers.

func ProviderName

func ProviderName(s string) string

ProviderName normalizes a mail provider id.

func ValidateProvider

func ValidateProvider(name string) error

ValidateProvider reports whether name is a known provider id.

Types

type LogSender

type LogSender struct {
	Log *slog.Logger
}

LogSender logs messages instead of delivering them (local/dev/tests).

func (LogSender) Send

func (s LogSender) Send(_ context.Context, msg Message) error

type MemorySender

type MemorySender struct {
	Sent []Message
	// contains filtered or unexported fields
}

MemorySender records sent messages for tests.

func (*MemorySender) Send

func (s *MemorySender) Send(_ context.Context, msg Message) error

type Message

type Message struct {
	To       string
	Subject  string
	TextBody string
	HTMLBody string
}

Message is an outbound email.

func InviteExistingUser

func InviteExistingUser(orgName, loginURL string) Message

InviteExistingUser builds the notification for an existing platform user.

func InviteNewUser

func InviteNewUser(orgName, acceptURL string) Message

InviteNewUser builds the invite email for an unknown address.

func PasswordReset

func PasswordReset(resetURL string) Message

PasswordReset builds the password recovery email.

func TestMessage

func TestMessage() Message

TestMessage builds a simple connectivity test email.

type Sender

type Sender interface {
	Send(ctx context.Context, msg Message) error
}

Sender delivers email messages.

Jump to

Keyboard shortcuts

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