email

package
v0.0.0-...-bbaddd9 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 12 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderTemplate

func RenderTemplate(templateName string, data interface{}) (string, error)

func SendEmail

func SendEmail(backend EmailBackend, from string, to []string, subject, htmlBody, plainTextBody string) error

Types

type DummyBackend

type DummyBackend struct {
	SentMessages []DummyMessage
	// contains filtered or unexported fields
}

func NewDummyBackend

func NewDummyBackend() *DummyBackend

func (*DummyBackend) GetFrom

func (b *DummyBackend) GetFrom() string

func (*DummyBackend) SendEmail

func (b *DummyBackend) SendEmail(from string, to []string, subject, htmlBody, plainTextBody string) error

type DummyMessage

type DummyMessage struct {
	From          string
	To            []string
	Subject       string
	HTMLBody      string
	PlainTextBody string
}

type EmailBackend

type EmailBackend interface {
	SendEmail(from string, to []string, subject string, htmlBody string, plainTextBody string) error
	GetFrom() string
}

func GetEmailBackendFromConfig

func GetEmailBackendFromConfig(config *EmailConfigDef) (EmailBackend, error)

type EmailBackendType

type EmailBackendType string
const (
	EmailBackendTypeSMTP EmailBackendType = "smtp"
	EmailBackendDummy    EmailBackendType = "dummy"
)

func (EmailBackendType) IsValid

func (ebt EmailBackendType) IsValid() bool

type EmailConfigDef

type EmailConfigDef struct {
	Type EmailBackendType
	SMTP *SMTPConfigDef
}

func ReadEmailConfigFromEnv

func ReadEmailConfigFromEnv() EmailConfigDef

func (*EmailConfigDef) Hash

func (ecd *EmailConfigDef) Hash() string

type SMTPBackend

type SMTPBackend struct {
	Host     string
	Port     string
	Username string
	Password string
	From     string
}

func NewSMTPBackend

func NewSMTPBackend(config *SMTPConfigDef) (*SMTPBackend, error)

func (*SMTPBackend) GetFrom

func (s *SMTPBackend) GetFrom() string

func (*SMTPBackend) SendEmail

func (s *SMTPBackend) SendEmail(from string, to []string, subject, htmlBody, plainTextBody string) error

type SMTPConfigDef

type SMTPConfigDef struct {
	Host     string
	Port     string
	Username string
	Password string
	From     string
}

func (*SMTPConfigDef) Hash

func (scd *SMTPConfigDef) Hash() string

Jump to

Keyboard shortcuts

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