mailtemplate

package
v0.0.0-...-f17429d Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mailtemplate holds built-in mail template metadata (codes expected by send logic).

Index

Constants

View Source
const (
	TplEmailLoginCode     = "html/email_login_code.html"
	TplEmailVerification  = "html/email_verification.html"
	TplVerification       = "html/verification.html"
	TplPasswordReset      = "html/password_reset.html"
	TplWelcome            = "html/welcome.html"
	TplNewDeviceLogin     = "html/new_device_login.html"
	TplDeviceVerification = "html/device_verification.html"
	TplGroupInvitation    = "html/group_invitation.html"
)

嵌入模版路径(相对本包 embed 根)。

Variables

This section is empty.

Functions

func RenderHTML

func RenderHTML(relPath string, data any) (string, error)

RenderHTML 读取嵌入文件并用 html/template 渲染(自动转义文本字段)。

func UsernameFromEmail

func UsernameFromEmail(email string) string

UsernameFromEmail 用邮箱 @ 前作为称呼占位。

Types

type Preset

type Preset struct {
	Code        string `json:"code"`
	Name        string `json:"name"`
	Description string `json:"description"`
	HTMLBody    string `json:"htmlBody"`
	Variables   string `json:"variables"` // JSON array string
}

Preset is a suggested row for admin UI; business code loads templates by Code from DB.

func DefaultPresets

func DefaultPresets() []Preset

DefaultPresets returns known template codes and default HTML skeletons (plain text is derived from HTML on save).

Jump to

Keyboard shortcuts

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