rfc5321

package
v0.0.0-...-a65c808 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The maximum total length of a reverse-path or forward-path is 256
	LimitPath = 256
	// The maximum total length of a user name or other local-part is 64
	// however, here we double it, since a few major services don't respect that and go over
	LimitLocalPart = 64 * 2
	// //The maximum total length of a domain name or number is 255
	LimitDomain = 255
	// The minimum total number of recipients that must be buffered is 100
	LimitRecipients = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressList

type AddressList struct {
	List  []SingleAddress
	Group string
}

type Parser

type Parser struct {
	PathParams      [][]string
	ADL             []string
	LocalPart       string
	LocalPartQuotes bool   // does the local part need quotes?
	Domain          string // can be an ip-address, enclosed in square brackets if it is
	IP              net.IP

	NullPath bool
	// contains filtered or unexported fields
}

Parse Email Addresses according to https://tools.ietf.org/html/rfc5321

func NewParser

func NewParser(buf []byte) *Parser

func (*Parser) Ehlo

func (s *Parser) Ehlo(input []byte) (domain string, ip net.IP, err error)

ehlo = "EHLO" SP ( Domain / address-literal ) CRLF Note: "HELO" is ignored here

func (*Parser) Helo

func (s *Parser) Helo(input []byte) (domain string, err error)

helo = "HELO" SP Domain CRLF Note: "HELO" is ignored here, so is the CRLF at the end

func (*Parser) MailFrom

func (s *Parser) MailFrom(input []byte) (err error)

MailFrom accepts the following syntax: Reverse-path [SP Mail-parameters] CRLF

func (*Parser) QcontentSMTP

func (s *Parser) QcontentSMTP() error

qtextSMTP / quoted-pairSMTP quoted-pairSMTP = %d92 %d32-126 qtextSMTP = %d32-33 / %d35-91 / %d93-126

func (*Parser) RcptTo

func (s *Parser) RcptTo(input []byte) (err error)

RcptTo accepts the following syntax: ( "<Postmaster@" Domain ">" / "<Postmaster>" /

Forward-path ) [SP Rcpt-parameters] CRLF

func (*Parser) Reset

func (s *Parser) Reset()

type RFC5322

type RFC5322 struct {
	AddressList
	Parser
	// contains filtered or unexported fields
}

Parse productions according to ABNF in RFC5322

func (*RFC5322) Address

func (s *RFC5322) Address(input []byte) (AddressList, error)

Address parses the "address" production specified in RFC5322 address = mailbox / group

type SingleAddress

type SingleAddress struct {
	DisplayName       string
	DisplayNameQuoted bool
	LocalPart         string
	LocalPartQuoted   bool
	Domain            string
	IP                net.IP
	NullPath          bool
}

Jump to

Keyboard shortcuts

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