Help us shape the future of Go! Take the 2026 Go Developer Survey

smtpclient

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT-0 Imports: 12 Imported by: 0

Documentation

Overview

Package smtpclient is the small SMTP submission client used by the perch CLI. It wraps Raven's SMTP client and exposes only the operations needed to send a composed message.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps Raven's SMTP client.

func Dial

func Dial(ctx context.Context, opts Options) (*Client, error)

Dial connects and optionally authenticates to an SMTP submission server.

func (*Client) Capabilities

func (c *Client) Capabilities() []string

Capabilities returns the extensions advertised by the server in a stable order, including any parameter (for example "SIZE 26214400").

func (*Client) Close

func (c *Client) Close() error

Close ends the SMTP session.

func (*Client) HasExtension

func (c *Client) HasExtension(name string) bool

HasExtension reports whether the server advertised an extension.

func (*Client) MaxSize

func (c *Client) MaxSize() int64

MaxSize returns the server's advertised SIZE limit, or zero when unlimited or not advertised.

func (*Client) Send

func (c *Client) Send(envelope Envelope, raw []byte) (string, error)

Send delivers raw to the server and returns any server-assigned message ID.

type Envelope

type Envelope struct {
	From       string
	Recipients []string
	SMTPUTF8   bool
	Body8Bit   bool
}

Envelope is the SMTP transport envelope for a message.

type Options

type Options struct {
	Addr      string
	TLSMode   TLSMode
	TLSConfig *tls.Config
	Username  string
	Password  string
	LocalName string
	Timeout   time.Duration
}

Options configures Dial.

type TLSMode

type TLSMode int

TLSMode selects how the client secures its SMTP connection.

const (
	// TLSImplicit connects with TLS immediately (usually port 465).
	TLSImplicit TLSMode = iota
	// TLSStartTLS connects in plaintext and upgrades with STARTTLS.
	TLSStartTLS
	// TLSDisabled sends everything in plaintext. It is only appropriate for
	// trusted loopback connections.
	TLSDisabled
)

Jump to

Keyboard shortcuts

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