Help us shape the future of Go! Take the 2026 Go Developer Survey

mailview

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package mailview renders branded transactional emails independently of delivery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Label string
	URL   string
}

type Brand

type Brand struct {
	Name         string
	AccentColor  string
	LogoURL      string
	WebsiteURL   string
	SupportEmail string
	Footer       string
}

Brand is copied at construction; it contains public presentation settings only.

func (Brand) Validate

func (b Brand) Validate() error

type Code

type Code struct {
	Value string
	Label string
	Hint  string
}

type Content

type Content struct {
	Subject string
	HTML    string
	Text    string
}

type Email

type Email struct {
	Subject    string
	Preheader  string
	Eyebrow    string
	Title      string
	Paragraphs []string
	Code       *Code
	Action     *Action
	Note       string
}

Email describes semantic content shared by transactional templates. All strings are escaped in HTML; callers cannot inject raw HTML, CSS, or JavaScript.

type Renderer

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

Renderer parses the layout/components once and is safe for concurrent rendering. Brand identity is private and copied, so changing config requires reconstruction.

func New

func New(brand Brand) (*Renderer, error)

func (*Renderer) Render

func (r *Renderer) Render(email Email) (Content, error)

Jump to

Keyboard shortcuts

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