email

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alternative

type Alternative struct {
	ContentType string
	Body        string
}

type Attachment

type Attachment struct {
	Filename    string
	ContentType string
	Body        []byte
}

type Backend

type Backend interface {
	SendMessages(context.Context, []Message) (int, error)
	Close() error
}

type ConsoleBackend

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

func NewConsoleBackend

func NewConsoleBackend(writer io.Writer) *ConsoleBackend

func (*ConsoleBackend) Close

func (b *ConsoleBackend) Close() error

func (*ConsoleBackend) SendMessages

func (b *ConsoleBackend) SendMessages(ctx context.Context, messages []Message) (int, error)

type DummyBackend

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

func NewDummyBackend

func NewDummyBackend() *DummyBackend

func (*DummyBackend) Close

func (b *DummyBackend) Close() error

func (*DummyBackend) Count

func (b *DummyBackend) Count() int

func (*DummyBackend) SendMessages

func (b *DummyBackend) SendMessages(ctx context.Context, messages []Message) (int, error)

type FailSilently

type FailSilently struct {
	FailSilently bool
}

type FileBackend

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

func NewFileBackend

func NewFileBackend(dir string) *FileBackend

func (*FileBackend) Close

func (b *FileBackend) Close() error

func (*FileBackend) SendMessages

func (b *FileBackend) SendMessages(ctx context.Context, messages []Message) (int, error)

type MemoryBackend

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

func NewMemoryBackend

func NewMemoryBackend() *MemoryBackend

func (*MemoryBackend) Clear

func (b *MemoryBackend) Clear()

func (*MemoryBackend) Close

func (b *MemoryBackend) Close() error

func (*MemoryBackend) Messages

func (b *MemoryBackend) Messages() []Message

func (*MemoryBackend) SendMessages

func (b *MemoryBackend) SendMessages(ctx context.Context, messages []Message) (int, error)

type Message

type Message struct {
	Subject      string
	Body         string
	From         string
	To           []string
	Cc           []string
	Bcc          []string
	ReplyTo      []string
	Headers      map[string]string
	Alternatives []Alternative
	Attachments  []Attachment
}

func (*Message) AddAlternative

func (m *Message) AddAlternative(contentType string, body string)

func (*Message) Attach

func (m *Message) Attach(filename string, contentType string, body []byte)

func (Message) Clone

func (m Message) Clone() Message

func (Message) Recipients

func (m Message) Recipients() []string

func (Message) RenderMIME

func (m Message) RenderMIME() ([]byte, error)

type SMTPBackend

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

func NewSMTPBackend

func NewSMTPBackend(options SMTPOptions) *SMTPBackend

func (*SMTPBackend) Close

func (b *SMTPBackend) Close() error

func (*SMTPBackend) Open

func (b *SMTPBackend) Open(ctx context.Context) error

func (*SMTPBackend) SendMessages

func (b *SMTPBackend) SendMessages(ctx context.Context, messages []Message) (int, error)

type SMTPOptions

type SMTPOptions struct {
	Host         string
	Port         int
	Username     string
	Password     string
	UseTLS       bool
	FailSilently bool
	Sender       SMTPSender
}

type SMTPSender

type SMTPSender interface {
	Open(context.Context) error
	Send(context.Context, Message, []byte) error
	Close() error
}

Jump to

Keyboard shortcuts

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