mailclient

package
v0.0.0-...-d6d061b Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientTypeSMTP     = "smtp"
	ClientTypeInMemory = "inmem"
	ClientTypeConsole  = "console"
)

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,
) ([]byte, error)

BuildMail builds multi-line email body using MIME format.

func NewConsoleClient

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

NewConsoleClient returns a new consoleClient.

func NewInMemClient

func NewInMemClient(username string) *inMemClient

NewInMemClient returns a new inMemClient.

func NewSMTPClient

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

NewSMTPClient returns a new smtpClient.

Types

type Client

type Client interface {
	Send(
		to []string,
		subject string,
		textTmpl *texttemplate.Template,
		htmlTmpl *htmltemplate.Template,
		tmplData any,
	) error
}

Client is used to handle sending of emails.

Jump to

Keyboard shortcuts

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