mailbox

package
v0.0.0-...-d641761 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package mailbox is a Go utility library that implements mailing primitives.

Index

Constants

View Source
const (
	// ClientTypeSMTP represents mail clients using SMTP protocol to send emails.
	ClientTypeSMTP = "smtp"
	// ClientTypeSMTP represents mail clients using console to print emails.
	ClientTypeConsole = "console"
	// BoundaryLength represents mail boundary length.
	BoundaryLength = 32
)

mail client types.

Variables

This section is empty.

Functions

func BuildMail

func BuildMail(
	from string,
	to []string,
	subject string,
	textTmpl *texttemplate.Template,
	htmlTmpl *htmltemplate.Template,
	tmplData any,
	timeProvider TimeProvider,
) ([]byte, error)

BuildMail builds multi-line email body using MIME format.

func NewConsoleClient

func NewConsoleClient(username string, timeProvider TimeProvider, writer io.Writer) *consoleClient

NewConsoleClient returns a new consoleClient.

func NewInMemMailClient

func NewInMemMailClient(username string, timeProvider TimeProvider) *inMemMailClient

NewInMemMailClient returns a new inMemMailClient.

func NewSMTPClient

func NewSMTPClient(
	hostname string,
	port int,
	username string,
	password string,
	timeProvider TimeProvider,
) *smtpClient

NewSMTPClient returns a new smtpClient.

func ParseMail

func ParseMail(msg string) (string, string, error)

ParseMail parses a given mail body.

Types

type TimeProvider

type TimeProvider interface {
	Now() time.Time
}

TimeProvider represents a component that provides the current timestamp.

Jump to

Keyboard shortcuts

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