smtppool

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package smtppool provides a thread-safe SMTP connection pool that reuses TCP connections via the RSET command for efficient bulk email validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HeloDomain      string
	MailFrom        string
	ConnectTimeout  time.Duration
	CommandTimeout  time.Duration
	Port            string
	MaxConnsPerHost int           // max idle connections per MX host (default: 3)
	MaxUsesPerConn  int           // max RCPT checks per connection before reconnect (default: 100)
	MaxConnAge      time.Duration // max lifetime of a connection (default: 5m)
	// Dial is injectable for testing. Defaults to net.DialTimeout.
	Dial func(network, address string, timeout time.Duration) (net.Conn, error)
}

Config configures the SMTP connection pool.

type Pool

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

Pool manages SMTP connections per MX host.

func New

func New(cfg Config) *Pool

New creates a new SMTP connection pool.

func (*Pool) CheckRCPT

func (p *Pool) CheckRCPT(mxHost, email string) (code int, msg string, err error)

CheckRCPT performs an SMTP RCPT TO check using a pooled connection. For new connections: Banner → EHLO → MAIL FROM → RCPT TO For reused connections: RSET → MAIL FROM → RCPT TO Returns the RCPT TO response code and message.

func (*Pool) Close

func (p *Pool) Close() error

Close closes all connections in the pool.

Jump to

Keyboard shortcuts

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