smtp

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend implements SMTP backend interface

func NewBackend

func NewBackend(
	userService mailService.UserServiceInterface,
	messageService mailService.MessageServiceInterface,
	queueService mailService.QueueServiceInterface,
	domainRepo repository.DomainRepository,
	telemetryService *repService.TelemetryService,
	dkimSigner *dkim.Signer,
	dkimVerifier *dkim.Verifier,
	spfValidator *spf.Validator,
	dmarcEnforcer *dmarc.Enforcer,
	greylister *greylist.Greylister,
	rateLimiter *ratelimit.Limiter,
	adaptiveLimiter *repService.AdaptiveLimiter,
	bruteForce *bruteforce.Protection,
	clamav *antivirus.ClamAV,
	spamAssassin *antispam.SpamAssassin,
	logger *zap.Logger,
) *Backend

NewBackend creates a new SMTP backend with all dependencies

func (*Backend) NewSession

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

NewSession creates a new SMTP session

type Config

type Config struct {
	Hostname    string
	DNSServer   string
	TLSMode     string // "none", "starttls", "tls"
	Username    string
	Password    string
	InsecureTLS bool
}

Config holds delivery worker configuration

type DeliveryWorker

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

DeliveryWorker handles outbound SMTP message delivery

func NewDeliveryWorker

func NewDeliveryWorker(
	queueService *service.QueueService,
	domainRepo repository.DomainRepository,
	messageService service.MessageServiceInterface,
	mailboxService service.MailboxServiceInterface,
	userService service.UserServiceInterface,
	telemetryService *repService.TelemetryService,
	logger *zap.Logger,
	config *Config,
) *DeliveryWorker

NewDeliveryWorker creates a new delivery worker

func (*DeliveryWorker) ProcessQueue

func (w *DeliveryWorker) ProcessQueue(ctx context.Context) error

ProcessQueue processes pending queue items

type Server

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

Server manages SMTP server instances

func NewServer

func NewServer(cfg *config.SMTPConfig, tlsCfg *tls.Config, backend *Backend, logger *zap.Logger) *Server

NewServer creates a new SMTP server manager

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown performs graceful shutdown

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts all SMTP servers

type Session

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

Session represents an SMTP session

func (*Session) Auth

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

Auth creates a SASL server for the specified mechanism This method implements the AuthSession interface to enable AUTH advertisement

func (*Session) AuthMechanisms

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

AuthMechanisms returns the list of supported authentication mechanisms This method implements the AuthSession interface to enable AUTH advertisement

func (*Session) AuthPlain

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

AuthPlain implements PLAIN authentication

func (*Session) Data

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

Data is called when the client sends DATA

func (*Session) Logout

func (s *Session) Logout() error

Logout is called when the session ends

func (*Session) Mail

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

Mail is called when the client sends MAIL FROM

func (*Session) Rcpt

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

Rcpt is called when the client sends RCPT TO

func (*Session) Reset

func (s *Session) Reset()

Reset is called when the client sends RSET

Jump to

Keyboard shortcuts

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