Versions in this module Expand all Collapse all v0 v0.1.0 May 6, 2023 Changes in this version + var ErrAuthDisabled = errors.New("auth is disabled") + func ListenAndServe(cfg *ServerConfig) error + func ListenAndServeTLS(cfg *ServerConfig) error + func SetDefaultServerConfig(cfg *ServerConfig) + func SplitAddress(address string) (string, string, error) + type Attachment struct + ContentType string + Data io.Reader + Filename string + type AuthFunc func(username, password string) error + type Backend struct + func NewBackend(auther AuthFunc, handler HandlerFunc) *Backend + func (bkd *Backend) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, error) + func (bkd *Backend) Login(state *smtp.ConnectionState, username, password string) (smtp.Session, error) + type Context struct + func (c Context) BodyReader() io.Reader + func (c Context) From() *mail.Address + func (c Context) Mailable() (bool, error) + func (c Context) Parse() (*Email, error) + func (c Context) Read(p []byte) (int, error) + func (c Context) RemoteAddr() net.Addr + func (c Context) SPF() (SPFResult, string, error) + func (c Context) TLS() *tls.ConnectionState + func (c Context) To() *mail.Address + func (c Context) User() (string, string, error) + type Email struct + Attachments []Attachment + Bcc []*mail.Address + Cc []*mail.Address + Content io.Reader + ContentType string + Date time.Time + EmbeddedFiles []EmbeddedFile + From []*mail.Address + HTMLBody string + Header mail.Header + InReplyTo []string + MessageID string + References []string + ReplyTo []*mail.Address + ResentBcc []*mail.Address + ResentCc []*mail.Address + ResentDate time.Time + ResentFrom []*mail.Address + ResentMessageID string + ResentSender *mail.Address + ResentTo []*mail.Address + Sender *mail.Address + Subject string + TextBody string + To []*mail.Address + func ParseEmail(r io.Reader) (email *Email, err error) + type EmbeddedFile struct + CID string + ContentType string + Data io.Reader + type HandlerFunc func(*Context) error + type SPFResult = spf.Result + type ServerConfig struct + Auther AuthFunc + BannerDomain string + Handler HandlerFunc + ListenAddr string + MaxMessageBytes int + ReadTimeout time.Duration + TLSConfig *tls.Config + WriteTimeout time.Duration + type Session struct + From *mail.Address + To *mail.Address + func NewSession(state *smtp.ConnectionState, handler HandlerFunc, username, password *string) *Session + func (s *Session) Data(r io.Reader) error + func (s *Session) Logout() error + func (s *Session) Mail(from string, opts smtp.MailOptions) (err error) + func (s *Session) Rcpt(to string) (err error) + func (s *Session) Reset()