smtptest

package
v2.24.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMockSMTPServer

func CreateMockSMTPServer(be *Backend, useTLS bool) (*smtp.Server, net.Listener, error)

nolint:revive // Yes, useTLS is a control flag.

func PingClient

func PingClient(listen net.Listener, useTLS bool, startTLS bool) (*smtp.Client, error)

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend(cfg Config) *Backend

func (*Backend) LastMessage

func (b *Backend) LastMessage() *Message

LastMessage returns a copy of the last message received by the backend.

func (*Backend) NewSession

func (b *Backend) NewSession(c *smtp.Conn) (smtp.Session, error)

NewSession is called after client greeting (EHLO, HELO).

func (*Backend) Reset

func (b *Backend) Reset()

type Config

type Config struct {
	AuthMechanisms                                       []string
	AcceptedIdentity, AcceptedUsername, AcceptedPassword string
	FailOnDataFn                                         func() error
}

type Message

type Message struct {
	AuthMech                     string
	Identity, Username, Password string // Auth
	From                         string
	To                           []string // Address
	Subject, Contents            string   // Content
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

func (*Session) Auth

func (s *Session) Auth(mech string) (sasl.Server, error)

Auth is the handler for supported authenticators.

func (*Session) AuthMechanisms

func (s *Session) AuthMechanisms() []string

AuthMechanisms returns a slice of available auth mechanisms; only PLAIN is supported in this example.

func (*Session) Data

func (s *Session) Data(r io.Reader) error

func (*Session) Logout

func (*Session) Logout() error

func (*Session) Mail

func (s *Session) Mail(from string, _ *smtp.MailOptions) error

func (*Session) Rcpt

func (s *Session) Rcpt(to string, _ *smtp.RcptOptions) error

func (*Session) Reset

func (*Session) Reset()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy