mail

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHistogramByBucket

func CreateHistogramByBucket(latencies []time.Duration, bucketCount int)

func CreateHistogramByDuration

func CreateHistogramByDuration(latencies []time.Duration, bucketSize time.Duration)

func GetLatencies

func GetLatencies(p string, w io.Writer) error

func HasFlexedPrefix

func HasFlexedPrefix(s, prefix string) bool

HasPrefix with Case-Insensitive

func HashID

func HashID() string

func IsMailText

func IsMailText(p string) bool

func OptimisticUID

func OptimisticUID() (string, error)

func ReadFirstBytes

func ReadFirstBytes(p string, bytes int) ([]byte, error)

func Send added in v0.20.0

func Send(data map[string]any, opts ...Option) (map[string]any, error)

Types

type Bulk

type Bulk struct {
	Addr       string `map:"addr" validate:"required"`
	From       string `map:"from" validate:"required"`
	To         string `map:"to" validate:"required"`
	Subject    string `map:"subject"`
	MyHostname string `map:"myhostname"`
	Session    int    `map:"session"`
	Message    int    `map:"message"`
	Length     int    `map:"length"`
	// contains filtered or unexported fields
}

func NewBulk

func NewBulk(p probe.ActionsParams) (*Bulk, error)

func (*Bulk) Deliver

func (b *Bulk) Deliver()

func (*Bulk) DeliverWithResult added in v0.19.0

func (b *Bulk) DeliverWithResult() DeliveryResult

func (*Bulk) MakeData added in v0.21.0

func (b *Bulk) MakeData() []byte

MakeData returns the mail data for external access

func (*Bulk) Send

func (b *Bulk) Send() (int, error)

type Callback added in v0.20.0

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

type Client

type Client struct {
	Text *textproto.Conn
	// contains filtered or unexported fields
}

func Dial

func Dial(addr string) (*Client, error)

func NewClient

func NewClient(conn net.Conn, host string) (*Client, error)

func (*Client) Auth

func (c *Client) Auth(a smtp.Auth) error

func (*Client) Close

func (c *Client) Close() error

func (*Client) Data

func (c *Client) Data() (io.WriteCloser, error)

func (*Client) Extension

func (c *Client) Extension(ext string) (bool, string)

func (*Client) Hello

func (c *Client) Hello(localName string) error

func (*Client) Mail

func (c *Client) Mail(from string) error

func (*Client) Noop

func (c *Client) Noop() error

func (*Client) Quit

func (c *Client) Quit() error

func (*Client) Rcpt

func (c *Client) Rcpt(to string) error

func (*Client) Reset

func (c *Client) Reset() error

func (*Client) StartTLS

func (c *Client) StartTLS(config *tls.Config) error

func (*Client) TLSConnectionState

func (c *Client) TLSConnectionState() (state tls.ConnectionState, ok bool)

func (*Client) Verify

func (c *Client) Verify(addr string) error

type DeliveryResult added in v0.19.0

type DeliveryResult struct {
	Sent     int
	Failed   int
	Total    int
	Sessions int
	Error    string
}

type Latencies

type Latencies struct {
	EarliestTime time.Time
	Data         []Latency
	MailDir      string
	TimeFormat   string
	TimeLocation *time.Location
}

func (*Latencies) FindEarliestSentTime

func (l *Latencies) FindEarliestSentTime() (time.Time, error)

func (*Latencies) Make

func (l *Latencies) Make() error

func (*Latencies) ParseMail

func (l *Latencies) ParseMail(p string) error

type Latency

type Latency struct {
	// SentTimeOffset is the time offset from the earliest sent time to when this email was sent
	SentTimeOffset time.Duration
	// ReceivedTimeOffset is the time offset from the earliest sent time to when this email was received
	ReceivedTimeOffset time.Duration
	SentTime           time.Time
	LastReceivedTime   time.Time
	EndToEnd           time.Duration
	FirstReceivedTime  time.Time
	Relay              time.Duration
	ReturnPath         string
	FilePath           string
}

type Mail

type Mail struct {
	Addr             string
	MailFrom         string
	RcptTo           []string
	Data             []byte
	Auth             smtp.Auth
	StartTLSDisabled bool
	MessageCount     int
}

func (*Mail) Send

func (m *Mail) Send() error

type MockServer

type MockServer struct {
	Addr string
	Name string
	Log  *log.Logger
	*TLS
}

func (*MockServer) Serve

func (s *MockServer) Serve() error

type MockServerSession

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

type Option added in v0.20.0

type Option func(*Callback)

func WithAfter added in v0.20.0

func WithAfter(f func(result *Result)) Option

func WithBefore added in v0.20.0

func WithBefore(f func(from string, to string, subject string)) Option

type Req added in v0.20.0

type Req struct {
	Addr       string `map:"addr" validate:"required"`
	From       string `map:"from" validate:"required"`
	To         string `map:"to" validate:"required"`
	Subject    string `map:"subject"`
	MyHostname string `map:"myhostname"`
	Session    int    `map:"session"`
	Message    int    `map:"message"`
	Length     int    `map:"length"`
	// contains filtered or unexported fields
}

func NewReq added in v0.20.0

func NewReq() *Req

func (*Req) Do added in v0.20.0

func (r *Req) Do() (*Result, error)

type Res added in v0.20.0

type Res struct {
	Code     int    `map:"code"`
	Sent     int    `map:"sent"`
	Failed   int    `map:"failed"`
	Total    int    `map:"total"`
	Error    string `map:"error"`
	MailData string `map:"maildata"` // For text mail data
	FilePath string `map:"filepath"` // For binary mail data files
}

type Result added in v0.20.0

type Result struct {
	Req    Req           `map:"req"`
	Res    Res           `map:"res"`
	RT     time.Duration `map:"rt"`
	Status int           `map:"status"`
}

type TLS

type TLS struct {
	CertPath string
	KeyPath  string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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