send

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package send submits messages over SMTP.

Index

Constants

This section is empty.

Variables

View Source
var ErrUncertain = errors.New("send: the server may have accepted the message")

ErrUncertain means the whole message reached the server but its verdict did not come back: it may have been accepted. Retrying could deliver it twice.

Functions

func Send

func Send(ctx context.Context, ep conn.Endpoint, from string, rcpts []string, raw []byte) error

Send submits raw to rcpts, stopping at the first refused recipient. An error that is not ErrUncertain happened before the server could accept the message, so retrying is safe; a *RejectedError is the server's refusal. Cancelling ctx closes the connection.

Types

type RejectedError added in v1.14.0

type RejectedError struct {
	// Stage is the refused command: "MAIL", "RCPT" or "DATA".
	Stage string
	// Recipient is the refused address at RCPT, "" at the other stages.
	Recipient string
	// Code is the reply code, such as 550: 4xx refuses for now, 5xx for good.
	Code int
	// Enhanced is the enhanced status code, such as "5.1.1"; "" if the server sent none.
	Enhanced string
	// Message is the server's reply text as it sent it.
	Message string
}

RejectedError is the server's refusal of the message at MAIL FROM, at a RCPT TO or at the end of DATA. The server has not accepted the message.

func (*RejectedError) Error added in v1.14.0

func (e *RejectedError) Error() string

Jump to

Keyboard shortcuts

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