Documentation
¶
Overview ¶
Package smtptester implements a simple SMTP server for testing. All received mails are saved in a sync.Map with a key:
From+Recipient1+Recipient2
Mails to the same sender and recipients will overwrite a previous received mail, when the recipients slice has the same order as in the mail received before.
Index ¶
- func LookupKey(f string, r []string) string
- func Standard() *server.Server
- func StandardWithAddress(addr string) *server.Server
- type Backend
- type Mail
- type Session
- func (Session) Auth(_ context.Context, _ string) (sasl.Server, error)
- func (Session) AuthMechanisms(_ context.Context) []string
- func (s *Session) Close(_ context.Context, _ error)
- func (s *Session) Data(_ context.Context, r func() io.Reader) (string, error)
- func (Session) Logger(_ context.Context) *slog.Logger
- func (s *Session) Mail(_ context.Context, from string, _ *smtp.MailOptions) error
- func (s *Session) Rcpt(_ context.Context, to string, _ *smtp.RcptOptions) error
- func (s *Session) Reset(ctx context.Context, _ bool) (context.Context, error)
- func (Session) STARTTLS(_ context.Context, config *tls.Config) (*tls.Config, error)
- func (Session) Verify(_ context.Context, _ string, _ *smtp.VrfyOptions) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StandardWithAddress ¶ added in v1.0.4
StandardWithAddress with address returns a standard SMTP server listenting on addr.
Types ¶
type Backend ¶
Backend is the backend for out test server. It contains a sync.Map with all mails received.
func GetBackend ¶
GetBackend returns the concrete type *Backend from SMTP server.
func NewBackend ¶
func NewBackend() *Backend
NewBackend returns a new Backend with an empty (not nil) Mails map.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
A Session is returned after successful login.
func (Session) AuthMechanisms ¶
AuthMechanisms implements the AuthMechanisms interface.