mailrules

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mailrules holds the rules every message must follow before a runner sends it: the idempotency key, plain addresses, header fields without line breaks or control characters, the allowed headers, sizes, mailbox folders and the pages of a mailbox list. A runner adds the app's own policy on top: the sender and the domains it may write to. mailer checks the same rules before it asks the runner.

Index

Constants

View Source
const (
	// MaxRecipients bounds To, Cc and Bcc together.
	MaxRecipients = 50
	// MaxAttachments bounds the attachments of one message.
	MaxAttachments = 20
	// MaxSize bounds the subject, the bodies and the attachments with their content types of one
	// message together, in bytes.
	MaxSize = 10 << 20
	// DefaultList is the number of messages a mailbox list returns when it asks for 0 or fewer.
	DefaultList = 50
	// MaxList bounds the number of messages one mailbox list returns.
	MaxList = 100
)

Variables

View Source
var Folders = []string{"inbox", "archive", "trash"}

Folders are the folders of an app's mailbox.

Functions

func Address

func Address(a string) error

Address checks one bare address: at most 254 bytes of visible ASCII, one @, no display name, and a domain that email.to_domains in aicoded.yaml could list.

func Check

func Check(msg *runnerv1.SendRequest) error

Check returns the first rule msg breaks, as a coded error, or nil.

func Domain

func Domain(a string) string

Domain returns the lower-case domain of a, or "" when Address refuses a.

func Folder

func Folder(name string) error

Folder checks the name of a mailbox folder.

func Page

func Page(offset, limit int) (int, int)

Page returns the offset and limit of a mailbox list: a negative offset is 0, a limit of 0 or less is DefaultList, and a limit above MaxList is MaxList.

func ValidDomain

func ValidDomain(d string) bool

ValidDomain reports whether d is a lower-case domain that email.to_domains in aicoded.yaml may list.

Types

This section is empty.

Jump to

Keyboard shortcuts

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