smtp

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: LGPL-3.0 Imports: 10 Imported by: 0

README

SMTP

A comprehensive library for sending and receiving emails using the SMTP protocol, written in Go.

Go Report Card Go Reference

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Send

func Send(args SenderArgs, mail *Mail, conn net.Conn, mxHost string) (err error)

Send sends an email to another server

func ViewMailQueue

func ViewMailQueue() map[time.Time]*MailQueueItem

ViewMailQueue returns the current mail queue

Types

type Address

type Address struct {
	Name    string
	Address string
}

Address is a struct that represents an email address

type AuthenticationBackend

type AuthenticationBackend struct {
	Authenticate        func(initial string, conn *textproto.Conn) (CheckAddress, error)
	SupportedMechanisms []string
}

AuthenticationBackend is a struct that represents an authentication backend

type CheckAddress added in v1.1.0

type CheckAddress func(*Address) (bool, error)

type DatabaseBackend

type DatabaseBackend struct {
	CheckUser func(*Address) (bool, error)
	WriteMail func(*Mail) error
}

DatabaseBackend is a struct that represents a database backend

type Mail

type Mail struct {
	From *Address
	To   []*Address
	Data []byte
}

Mail is a struct that represents an email

type MailQueueItem

type MailQueueItem struct {
	From *Address
	To   []*Address
	Host string
}

MailQueueItem is a struct that represents an item in the mail queue

type Receiver

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

Receiver is a struct that represents an SMTP receiver

func NewReceiver

func NewReceiver(conn net.Listener, hostname string, ownedDomains []string, enforceTLS bool, database DatabaseBackend, authentication AuthenticationBackend, tlsConfig *tls.Config) *Receiver

NewReceiver creates a new Receiver

func (*Receiver) Close

func (fr *Receiver) Close() error

Close closes the connection to the Receiver

func (*Receiver) Serve

func (fr *Receiver) Serve() error

Serve serves the Receiver. It will always return a non-nil error

type SenderArgs

type SenderArgs struct {
	EnforceTLS bool
}

SenderArgs is a struct that represents the arguments for the Sender

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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