Documentation ¶
Index ¶
- Variables
- func MimeHeaderDecode(str string) string
- type Address
- type Envelope
- func (e *Envelope) Len() int
- func (e *Envelope) NewReader() io.Reader
- func (e *Envelope) ParseHeaders() error
- func (e *Envelope) PopRcpt() Address
- func (e *Envelope) PushRcpt(addr Address)
- func (e *Envelope) Reseed(RemoteIP string, clientID uint64)
- func (e *Envelope) ResetTransaction()
- func (e *Envelope) String() string
- type Pool
Constants ¶
This section is empty.
Variables ¶
var Dec mime.WordDecoder
A WordDecoder decodes MIME headers containing RFC 2047 encoded-words. Used by the MimeHeaderDecode function. It's exposed public so that an alternative decoder can be set, eg Gnu iconv by importing the mail/inconv package. Another alternative would be to use https://godoc.org/golang.org/x/text/encoding
Functions ¶
func MimeHeaderDecode ¶
Converts 7 bit encoded mime header strings to UTF-8
Types ¶
type Address ¶
type Address struct { // User is local part User string // Host is the domain Host string // ADL is at-domain list if matched ADL []string // PathParams contains any ESTMP parameters that were matched PathParams [][]string // NullPath is true if <> was received NullPath bool }
Address encodes an email address of the form `<user@host>`
func NewAddress ¶
NewAddress takes a string of an RFC 5322 address of the form "Gogh Fir <gf@example.com>" or "foo@example.com".
type Envelope ¶
type Envelope struct { // Remote IP address RemoteIP string // Message sent in EHLO command Helo string // Sender MailFrom Address // Recipients RcptTo []Address // Data stores the header and message body Data bytes.Buffer // Subject stores the subject of the email, extracted and decoded after calling ParseHeaders() Subject string // TLS is true if the email was received using a TLS connection TLS bool // Header stores the results from ParseHeaders() Header textproto.MIMEHeader // Values hold the values generated when processing the envelope by the backend Values map[string]interface{} // Hashes of each email on the rcpt Hashes []string // additional delivery header that may be added DeliveryHeader string // Email(s) will be queued with this id QueuedId string // When locked, it means that the envelope is being processed by the backend sync.Mutex }
Email represents a single SMTP message.
func NewEnvelope ¶
func (*Envelope) Len ¶
Len returns the number of bytes that would be in the reader returned by NewReader()
func (*Envelope) NewReader ¶
Returns a new reader for reading the email contents, including the delivery headers
func (*Envelope) ParseHeaders ¶
ParseHeaders parses the headers into Header field of the Envelope struct. Data buffer must be full before calling. It assumes that at most 30kb of email data can be a header Decoding of encoding to UTF is only done on the Subject, where the result is assigned to the Subject field
func (*Envelope) ResetTransaction ¶
func (e *Envelope) ResetTransaction()
ResetTransaction is called when the transaction is reset (keeping the connection open)