emailprovider

package
v1.85.2 Latest Latest
Warning

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

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

Documentation

Overview

Package emailprovider defines provider-neutral email sending types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Name  string
	Email string
}

Address identifies an email mailbox and its optional display name.

func (Address) String

func (a Address) String() string

String formats the address as an RFC 5322 mailbox.

type Message

type Message struct {
	Recipient Address
	Subject   string
	HTMLBody  string
	TextBody  string
	Metadata  map[string]string
}

Message is one private email for one recipient. A Sender may batch multiple messages internally, but it must not expose recipients to one another.

type Result

type Result struct {
	Recipient  Address
	Status     Status
	ProviderID string
	Err        error
}

Result describes the outcome for the message at the same index passed to Send.

type Sender

type Sender interface {
	Send(ctx context.Context, messages []Message) ([]Result, error)
}

Sender submits email in bulk. Results must correspond by index to messages. A non-nil method error indicates that at least one result may be incomplete; callers should inspect both the returned results and error.

type Status

type Status string

Status describes whether a provider accepted a message for delivery.

const (
	// StatusAccepted means the provider accepted the message. It does not imply delivery.
	StatusAccepted Status = "accepted"
	// StatusRejected means the provider rejected the message before delivery.
	StatusRejected Status = "rejected"
	// StatusUnknown means the provider could not determine whether it accepted the message.
	StatusUnknown Status = "unknown"
)

Directories

Path Synopsis
Package sendgrid implements emailprovider.Sender with SendGrid's v3 Mail Send API.
Package sendgrid implements emailprovider.Sender with SendGrid's v3 Mail Send API.

Jump to

Keyboard shortcuts

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