Files
go-smtp/backend.go
T
fox.cppandemersion 1a1363a5da server: Immediately pass envelope information to the backend
This allows backend to return an error on MAIL FROM or RCPT TO
(https://github.com/emersion/go-smtp/issues/22).

backendutil.TransformBackend is removed for reasons explained here:
https://github.com/emersion/go-smtp/issues/22#issuecomment-475669004
2019-03-22 22:54:13 +02:00

38 lines
978 B
Go

package smtp
import (
"errors"
"io"
)
var (
ErrAuthRequired = errors.New("Please authenticate first")
ErrAuthUnsupported = errors.New("Authentication not supported")
)
// A SMTP server backend.
type Backend interface {
// Authenticate a user. Return smtp.ErrAuthUnsupported if you don't want to
// support this.
Login(state *ConnectionState, username, password string) (Session, error)
// Called if the client attempts to send mail without logging in first.
// Return smtp.ErrAuthRequired if you don't want to support this.
AnonymousLogin(state *ConnectionState) (Session, error)
}
type Session interface {
// Discard currently processed message.
Reset()
// Free all resources associated with session.
Logout() error
// Set return path for currently processed message.
Mail(from string) error
// Add recipient for currently processed message.
Rcpt(to string) error
// Set currently processed message contents and send it.
Data(r io.Reader) error
}