mail

package
v0.0.0-...-d364ca2 Latest Latest
Warning

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

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

Documentation

Overview

Package mail provides Soro messages, templates, transports, and queued delivery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptureTransport

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

func NewCaptureTransport

func NewCaptureTransport() *CaptureTransport

func (*CaptureTransport) Messages

func (transport *CaptureTransport) Messages() []*Message

func (*CaptureTransport) Name

func (transport *CaptureTransport) Name() string

func (*CaptureTransport) Reset

func (transport *CaptureTransport) Reset()

func (*CaptureTransport) Send

func (transport *CaptureTransport) Send(ctx context.Context, message *Message) error

type Client

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

func New

func New(transport Transport, jobClient *jobs.Client, observer *observability.Provider, logger *slog.Logger, config Config) (*Client, error)

func (*Client) Delivery

func (client *Client) Delivery(message *Message) *Delivery

func (*Client) Send

func (client *Client) Send(ctx context.Context, message *Message) (sendErr error)

type Config

type Config struct {
	DefaultFrom string
	Queue       string
}

type ConsoleTransport

type ConsoleTransport struct {
	Writer io.Writer
	// contains filtered or unexported fields
}

func (*ConsoleTransport) Name

func (transport *ConsoleTransport) Name() string

func (*ConsoleTransport) Send

func (transport *ConsoleTransport) Send(ctx context.Context, message *Message) error

type Delivery

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

func (*Delivery) Send

func (delivery *Delivery) Send(ctx context.Context) error

func (*Delivery) SendLater

func (delivery *Delivery) SendLater(ctx context.Context, options ...jobs.Option) (*jobs.Result, error)

type Message

type Message struct {
	From    string   `json:"from"`
	To      []string `json:"to"`
	CC      []string `json:"cc,omitempty"`
	BCC     []string `json:"bcc,omitempty"`
	Subject string   `json:"subject"`
	Text    string   `json:"text,omitempty"`
	HTML    string   `json:"html,omitempty"`
}

func (*Message) Clone

func (message *Message) Clone() *Message

func (*Message) Validate

func (message *Message) Validate() error

type SMTPConfig

type SMTPConfig struct {
	Host               string
	Port               int
	Username           string
	Password           string
	StartTLS           bool
	ImplicitTLS        bool
	InsecureSkipVerify bool
	Timeout            time.Duration
}

type SMTPTransport

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

func NewSMTPTransport

func NewSMTPTransport(config SMTPConfig) (*SMTPTransport, error)

func (*SMTPTransport) Name

func (transport *SMTPTransport) Name() string

func (*SMTPTransport) Send

func (transport *SMTPTransport) Send(ctx context.Context, message *Message) error

type Templates

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

func ParseTemplates

func ParseTemplates(name, subject, textBody, htmlBody string) (*Templates, error)

func (*Templates) Render

func (templates *Templates) Render(data any) (subject, textBody, htmlBody string, err error)

type Transport

type Transport interface {
	Send(context.Context, *Message) error
}

Jump to

Keyboard shortcuts

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