email

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidOrganizationName = errors.New("invalid organization name")

Functions

func RenderEmailChangeCodeHTML added in v0.1.15

func RenderEmailChangeCodeHTML(code string) (string, error)

func RenderOrganizationInvitationHTML added in v0.1.24

func RenderOrganizationInvitationHTML(orgName, inviteURL, role, expiresAt string) (string, error)

func RenderPasswordResetCodeHTML added in v0.1.14

func RenderPasswordResetCodeHTML(code string) (string, error)

func RenderSignupCodeHTML

func RenderSignupCodeHTML(code string) (string, error)

Types

type LoginAlertPayload

type LoginAlertPayload struct {
	V          int       `json:"v"`
	IPAddress  string    `json:"ip_address"`
	LoggedInAt time.Time `json:"logged_in_at"`
	UserAgent  string    `json:"user_agent,omitempty"`
}

type Message

type Message struct {
	Subject string
	Text    string
	HTML    string
}

func BuildEmailChangeCodeMessage added in v0.1.15

func BuildEmailChangeCodeMessage(code string) (Message, error)

func BuildOrganizationInvitationMessage added in v0.1.24

func BuildOrganizationInvitationMessage(payload OrganizationInvitationPayload) (Message, error)

func BuildPasswordResetCodeMessage added in v0.1.14

func BuildPasswordResetCodeMessage(code string) (Message, error)

func BuildSignupCodeMessage

func BuildSignupCodeMessage(code string) (Message, error)

type NoopSender

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

func NewNoopSender

func NewNoopSender(cfg NoopSenderConfig) *NoopSender

func (*NoopSender) Send

func (s *NoopSender) Send(ctx context.Context, to string, msg Message) error

type NoopSenderConfig

type NoopSenderConfig struct {
	Logger *slog.Logger
}

type OrganizationInvitationPayload added in v0.1.24

type OrganizationInvitationPayload struct {
	OrganizationName string `json:"organization_name"`
	InviteURL        string `json:"invite_url"`
	Role             string `json:"role"`
	ExpiresAt        string `json:"expires_at"`
}

type SMTPSender

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

func NewSMTPSender

func NewSMTPSender(
	host string,
	port int,
	username string,
	password string,
	from string,
	useTLS bool,
	timeout time.Duration,
) *SMTPSender

func (*SMTPSender) Send

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

type Sender

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

type Service

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

func NewService

func NewService(sender Sender) *Service

func (*Service) Send

func (s *Service) Send(ctx context.Context, to string, msg Message) error

Jump to

Keyboard shortcuts

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