mail

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package mail is stackr's outbound transactional email: one SMTP2GO adapter behind hamr's email.Sender, plus the dev inbox.

Mail is optional. A self-hosted install with no provider configured still works, every message stackr sends (today: org invites) has a link the sender can copy and pass on by hand, so an unconfigured server degrades to that rather than failing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mailer

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

Mailer is a configured sender plus the address it sends as. Nil means no provider is configured; callers check Enabled and fall back to copy-the-link.

func FromEnv

func FromEnv() *Mailer

FromEnv wires the mailer from the environment. Nil when nothing is set:

SMTP2GO_API_KEY   api key; without it there is no provider
MAIL_FROM         sender address, e.g. "stackr <no-reply@example.com>"
EMAIL_MOCK=true   send to hamr dev's inbox at HAMR_DEV_URL instead

func (*Mailer) Enabled

func (m *Mailer) Enabled() bool

Enabled reports whether mail can actually be sent.

func (*Mailer) Send

func (m *Mailer) Send(ctx context.Context, to email.Address, subject, text, html string) error

Send delivers one message from the configured address. A nil mailer is not an error: it means this server has no provider, which callers treat as "hand the link over yourself".

Jump to

Keyboard shortcuts

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