Documentation ¶
Index ¶
- func MailTransportDecode(str string, encodingType string, charset string) string
- 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 ¶
This section is empty.
Functions ¶
func MailTransportDecode ¶
decode from 7bit to 8bit UTF-8 encodingType can be "base64" or "quoted-printable"
func MimeHeaderDecode ¶
Decode strings in Mime header format eg. =?ISO-2022-JP?B?GyRCIVo9dztSOWJAOCVBJWMbKEI=?= This function uses GNU iconv under the hood, for more charset support than in Go's library
Types ¶
type Address ¶
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 // to determine user AuthorizedLogin string }
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)