email

package
v0.4.3 Latest Latest
Warning

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

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

Documentation

Overview

Package email provides the interface and implementations for sending email.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	From    string
	To      []string
	Subject string
	// Body is the HTML body of the email.
	Body string
}

Message represents an outbound email message.

type NoopSender

type NoopSender struct{}

NoopSender discards all messages. Use in tests or when email is disabled.

func (*NoopSender) Send

func (n *NoopSender) Send(_ context.Context, _ Message) error

Send discards the message and returns nil.

type SMTPSender

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

SMTPSender delivers email via SMTP. For local development, use mailhog (no auth, no TLS required).

func NewSMTPSender

func NewSMTPSender(host string, port int, from string) *SMTPSender

NewSMTPSender creates an SMTPSender that connects to the given host and port. The from address is used when the Message.From field is empty.

func (*SMTPSender) Send

func (s *SMTPSender) Send(_ context.Context, msg Message) error

Send delivers msg via SMTP. It uses no authentication, which is appropriate for local relay (mailhog) and internal SMTP servers. For production use with auth, wrap this or extend with an authenticated variant.

type Sender

type Sender interface {
	Send(ctx context.Context, msg Message) error
}

Sender is the interface for delivering email messages.

Jump to

Keyboard shortcuts

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