authtest

package
v0.0.0-...-0cf49f2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2015 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mail

type Mail struct {
	From string
	To   []string
	Data []byte
}

Mail represents an email message that has been sent to the fake server.

type SMTPServer

type SMTPServer struct {
	// MailBox is the slice that stores all messages that have arrived to
	// the server while it's listening. Use the mutex to access it, or bad
	// things can happen.
	MailBox []Mail
	sync.RWMutex
	// contains filtered or unexported fields
}

SMTPServer is a fake SMTP server implementation.

This SMTP server does not support authentication and is supposed to be used in tests only.

Use NewSMTPServer create a new instance and start serving; SMTPServer.Addr() will get you the address of the server and Stop will stop the server, closing the listener. Every message that arrive at the server is stored in the MailBox slice.

func NewSMTPServer

func NewSMTPServer() (*SMTPServer, error)

NewSMTPServer creates a new SMTP server, for testing purposes.

func (*SMTPServer) Addr

func (s *SMTPServer) Addr() string

Addr returns the address of the server, in the form <host>:<port>.

func (*SMTPServer) Reset

func (s *SMTPServer) Reset()

Reset resets the server, cleaning up the mailbox.

func (*SMTPServer) Stop

func (s *SMTPServer) Stop()

Stop stops the server. It's safe to call this method multiple times.

Jump to

Keyboard shortcuts

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