mail

package
v0.0.0-...-ba52af2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PreviewHandler

func PreviewHandler(c buffalo.Context) error

PreviewHandler shows sent emails in development mode

func Send

func Send(ctx context.Context, msg Message) error

Send sends an email using the global sender

func UseSender

func UseSender(s Sender)

UseSender sets the global mail sender

Types

type DevSender

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

DevSender logs emails instead of sending them (for development)

func NewDevSender

func NewDevSender() *DevSender

NewDevSender creates a new development sender

func (*DevSender) GetMessages

func (d *DevSender) GetMessages() []Message

GetMessages returns stored messages (for preview)

func (*DevSender) Send

func (d *DevSender) Send(ctx context.Context, msg Message) error

Send logs the email instead of sending it

type Message

type Message struct {
	From    string   // Optional, uses default if empty
	To      string   // Required recipient email
	Cc      []string // Optional CC recipients
	Bcc     []string // Optional BCC recipients
	Subject string   // Email subject
	Text    string   // Plain text body
	HTML    string   // HTML body (optional)
}

Message represents an email message

type NoOpSender

type NoOpSender struct{}

NoOpSender does nothing (for testing)

func (*NoOpSender) Send

func (n *NoOpSender) Send(ctx context.Context, msg Message) error

Send does nothing

type SMTPConfig

type SMTPConfig struct {
	Addr     string // Host:port (e.g., "smtp.gmail.com:587")
	User     string // SMTP username
	Password string // SMTP password
	From     string // Default sender email
}

SMTPConfig holds SMTP server configuration

type SMTPSender

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

SMTPSender sends emails via SMTP

func NewSMTPSender

func NewSMTPSender(config SMTPConfig) *SMTPSender

NewSMTPSender creates a new SMTP sender

func (*SMTPSender) Send

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

Send sends an email via SMTP

type Sender

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

Sender is the interface for sending emails

func GetSender

func GetSender() Sender

GetSender returns the current mail sender

Jump to

Keyboard shortcuts

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