Help us shape the future of Go! Take the 2026 Go Developer Survey

email

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package email sends verification messages over SMTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

Credentials contains SMTP authentication credentials.

func ParseCredentials

func ParseCredentials(raw string) (Credentials, error)

ParseCredentials parses and validates JSON-encoded SMTP credentials.

type OTPMailer

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

OTPMailer renders and sends one-time verification code messages.

func NewOTPMailer

func NewOTPMailer(mailer *SMTPMailer, templates *templates.Manager, ttl time.Duration) *OTPMailer

NewOTPMailer creates an SMTP-backed one-time code mailer.

func (*OTPMailer) SendOTP

func (m *OTPMailer) SendOTP(ctx context.Context, to, code string, expiresAt time.Time) error

SendOTP renders and sends an OTP message with its exact expiry to an email address.

type SMTPMailer

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

SMTPMailer sends multipart messages over SMTP.

func NewSMTPMailer

func NewSMTPMailer(config config.SMTPConfig, credentials Credentials) *SMTPMailer

NewSMTPMailer creates an SMTP transport.

type Sender

type Sender interface {
	SendOTP(ctx context.Context, to, code string, expiresAt time.Time) error
}

Sender sends the application email messages supported by Truster.

Jump to

Keyboard shortcuts

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