Versions in this module Expand all Collapse all v1 v1.2.0 Aug 6, 2020 Changes in this version type Reader + func (r *Reader) DotReader2() io.Reader + type SessionFactory interface + New func() Session v1.1.0 May 8, 2020 Changes in this version + var EnhancedCodeNotSet = EnhancedCode + var ErrAuthRequired = errors.New("Please authenticate first") + var ErrAuthUnsupported = errors.New("Authentication not supported") + var ErrDataTooLarge = &SMTPError + var NoEnhancedCode = EnhancedCode + func CanonicalMIMEHeaderKey(s string) string + type Backend interface + AnonymousLogin func(state *ConnectionState) (Session, error) + Login func(state *ConnectionState, username, password string) (Session, error) + func NewDefaultBackend(s Session) Backend + type Conn struct + XForward *XForward + func (c *Conn) Close() error + func (c *Conn) ReadLine() (string, error) + func (c *Conn) Reject() + func (c *Conn) Server() *Server + func (c *Conn) Session() Session + func (c *Conn) SetSession(session Session) + func (c *Conn) State() ConnectionState + func (c *Conn) TLSConnectionState() (state tls.ConnectionState, ok bool) + func (c *Conn) WriteResponse(code int, enhCode EnhancedCode, text ...string) + type ConnectionState struct + Hostname string + RemoteAddr net.Addr + TLS tls.ConnectionState + type DataContext interface + GetHelo func() string + GetXForward func() XForward + SetSMTPResponse func(response *SMTPError) + SetStatus func(rcpt string, status *SMTPError) + StartDelivery func(ctx context.Context, rcpt string) + type DefaultBackend struct + func (be *DefaultBackend) AnonymousLogin(state *ConnectionState) (Session, error) + func (be *DefaultBackend) Login(state *ConnectionState, username, password string) (Session, error) + type DefaultSession struct + From string + Rcpts []string + func (s *DefaultSession) Data(r io.Reader, sc DataContext) error + func (s *DefaultSession) Logout() error + func (s *DefaultSession) Mail(from string) error + func (s *DefaultSession) Rcpt(to string) error + func (s *DefaultSession) Reset() + type EnhancedCode [3]int + type Logger interface + Printf func(format string, v ...interface{}) + Println func(v ...interface{}) + type Option interface + func Addr(addr string) Option + func AllowInsecureAuth() Option + func AllowXForward() Option + func DebugToWriter(i io.Writer) Option + func DisableAuth() Option + func Domain(domain string) Option + func ErrorLogger(l Logger) Option + func LMTP() Option + func MaxMessageBytes(maxMsgBytes int) Option + func MaxRecipients(maxRcpts int) Option + func ReadTimeout(t time.Duration) Option + func StrictMode() Option + func TLSConfig(tlsconfig *tls.Config) Option + func UnixSocket() Option + func WriteTimeout(t time.Duration) Option + type Reader struct + R *bufio.Reader + func NewReader(r *bufio.Reader) *Reader + func (r *Reader) DotReader() io.Reader + func (r *Reader) ReadCodeLine(expectCode int) (code int, message string, err error) + func (r *Reader) ReadContinuedLine() (string, error) + func (r *Reader) ReadContinuedLineBytes() ([]byte, error) + func (r *Reader) ReadDotBytes() ([]byte, error) + func (r *Reader) ReadDotLines() ([]string, error) + func (r *Reader) ReadLine() (string, error) + func (r *Reader) ReadLineBytes() ([]byte, error) + func (r *Reader) ReadMIMEHeader() (textproto.MIMEHeader, error) + func (r *Reader) ReadResponse(expectCode int) (code int, message string, err error) + type SMTPError struct + Code int + EnhancedCode EnhancedCode + Message string + func (err *SMTPError) Error() string + type SaslServerFactory func(conn *Conn) sasl.Server + type Server struct + func NewServer(be Backend, opts ...Option) *Server + func (s *Server) Close() + func (s *Server) EnableAuth(name string, f SaslServerFactory) + func (s *Server) ForEachConn(f func(*Conn)) + func (s *Server) ListenAndServe() error + func (s *Server) ListenAndServeTLS() error + func (s *Server) Serve(l net.Listener) error + type Session interface + Data func(r io.Reader, d DataContext) error + Logout func() error + Mail func(from string) error + Rcpt func(to string) error + Reset func() + type TextConn struct + func NewTextConn(conn io.ReadWriteCloser) *TextConn + func (c *TextConn) Close() error + type XForward struct + Addr string + Helo string + Name string + Proto string