devmail

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package devmail provides the development-default ports.Mailer and ports.SMSSender: they deliver nothing and log the message with log/slog.

This is what makes dilion.NewServer(WithDSN(...)) work out of the box (§2.4 "batteries included"). It must never be used in production: recipients and message bodies (magic links, OTP codes) end up in the process log, so addresses are masked at info level and full bodies are logged only at debug.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaskEmail

func MaskEmail(addr string) string

MaskEmail renders an address as "j***@example.com".

func MaskPhone

func MaskPhone(num string) string

MaskPhone keeps the first three and last two characters: "+82*******78".

Types

type Mailer

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

Mailer logs outbound email instead of sending it.

func NewMailer

func NewMailer(log *slog.Logger) *Mailer

NewMailer returns a Mailer logging to log (slog.Default() when nil).

func (*Mailer) Send

func (m *Mailer) Send(ctx context.Context, to, subject, textBody, htmlBody string) error

Send logs the message and always succeeds.

type SMS

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

SMS logs outbound SMS instead of sending it.

func NewSMS

func NewSMS(log *slog.Logger) *SMS

NewSMS returns an SMS sender logging to log (slog.Default() when nil).

func (*SMS) Send

func (s *SMS) Send(ctx context.Context, to, body string) error

Send logs the message and always succeeds.

Jump to

Keyboard shortcuts

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