smtp

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serv

func Serv(
	addr string,
	readTimeOut time.Duration,
	writeTimeOut time.Duration,
	maxMessageBytes int,
	handler DataHandler,
) error

Types

type Backend

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

The Backend implements SMTP server methods.

func (*Backend) NewSession

func (bkd *Backend) NewSession(_ *smtp.Conn) (smtp.Session, error)

type DataHandler

type DataHandler func(message db.Message)

type Session

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

Session represents a SMTP session.

func (*Session) AuthPlain

func (s *Session) AuthPlain(username, password string) error

AuthPlain is a callback function for handling PLAIN authentication.

func (*Session) Data

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

Data is a callback function for handling DATA command. It reads the email data from the provided io.Reader, parses it using letters library, and calls the dataHandler with the parsed email data.

func (*Session) Logout

func (s *Session) Logout() error

Logout is a callback function for handling LOGOUT command.

func (*Session) Mail

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

Mail is a callback function for handling MAIL command.

func (*Session) Rcpt

func (s *Session) Rcpt(to string) error

Rcpt is a callback function for handling RCPT command.

func (*Session) Reset

func (s *Session) Reset()

Reset is a callback function for handling RSET command.

Jump to

Keyboard shortcuts

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