email

package
v0.0.0-...-e1e9d1d Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package email defines the standard email interface for sending email messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	From       *mail.Address
	ReplyTo    *mail.Address
	Recipient  *Recipient
	Recipients []*Recipient
	Subject    string
	Content    string
	MIMEType   string
}

Email defines an email to send, indicating who its from, who should receive replies, who should be the recipient(s), and the actual subject and content of the message.

type MockSender

type MockSender struct {
	SendFunc func(context.Context, *Email) error
}

MockSender is a test mock for the Sender interface.

func (*MockSender) Send

func (m *MockSender) Send(ctx context.Context, email *Email) error

type Recipient

type Recipient struct {
	Address *mail.Address
	Type    RecipientType
}

A Recipient defines a recipient of an email.

type RecipientType

type RecipientType string

RecipientType indicates the type of recipient.

const (
	ToRecipient  RecipientType = "to"
	CCRecipient  RecipientType = "cc"
	BCCRecipient RecipientType = "bcc"
)

List of valid recipient types.

type Sender

type Sender interface {
	// Send sends an email. When ctx is cancelled, send should stop and an error
	// be returned.
	Send(context.Context, *Email) error
}

Sender defines the sending interface of an email.

Jump to

Keyboard shortcuts

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