policy

package
v0.0.0-...-30e5c69 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEmailAddress

func ParseEmailAddress(address string) (local string, domain string, err error)

ParseEmailAddress unescapes an email address, and splits the local part from the domain part. An error is returned if the local or domain parts fail validation following the guidelines in RFC3696.

func ValidateDomainPart

func ValidateDomainPart(domain string) bool

ValidateDomainPart returns true if the domain part complies to RFC3696, RFC1035. Used by ParseEmailAddress().

Types

type Addressing

type Addressing struct {
	Config *config.Root
}

Addressing handles email address policy.

func (*Addressing) ExtractMailbox

func (a *Addressing) ExtractMailbox(address string) (string, error)

ExtractMailbox extracts the mailbox name from a partial email address.

func (*Addressing) NewRecipient

func (a *Addressing) NewRecipient(address string) (*Recipient, error)

NewRecipient parses an address into a Recipient.

func (*Addressing) ShouldAcceptDomain

func (a *Addressing) ShouldAcceptDomain(domain string) bool

ShouldAcceptDomain indicates if TempMail accepts mail destined for the specified domain.

func (*Addressing) ShouldStoreDomain

func (a *Addressing) ShouldStoreDomain(domain string) bool

ShouldStoreDomain indicates if TempMail stores mail destined for the specified domain.

type Recipient

type Recipient struct {
	mail.Address

	// LocalPart is the part of the address before @, including +extension.
	LocalPart string
	// Domain is the part of the address after @.
	Domain string
	// Mailbox is the canonical mailbox name for this recipient.
	Mailbox string
	// contains filtered or unexported fields
}

Recipient represents a potential email recipient, allows policies for it to be queried.

func (*Recipient) ShouldAccept

func (r *Recipient) ShouldAccept() bool

ShouldAccept returns true if TempMail should accept mail for this recipient.

func (*Recipient) ShouldStore

func (r *Recipient) ShouldStore() bool

ShouldStore returns true if TempMail should store mail for this recipient.

Jump to

Keyboard shortcuts

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