email

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Templates

func Templates(locale string) templateSet

Templates returns the email template functions for the given locale. Falls back to English if locale is not supported.

Types

type CredentialExpiryParams

type CredentialExpiryParams struct {
	UserName       string
	CredentialType string
	ExpiryDate     string
	DaysRemaining  int
}

type FlightReviewExpiryParams

type FlightReviewExpiryParams struct {
	UserName      string
	ExpiryDate    string
	DaysRemaining int
}

type FlightReviewRequiredParams

type FlightReviewRequiredParams struct {
	UserName string
	Message  string
}

type PassengerCurrencyParams

type PassengerCurrencyParams struct {
	UserName  string
	ClassType string
	Landings  int
	Required  int
	Remaining int
	Period    string // "day" or "night"
}

type RatingExpiryParams

type RatingExpiryParams struct {
	UserName      string
	LicenseType   string
	ClassType     string
	ExpiryDate    string
	DaysRemaining int
}

type RevalidationParams

type RevalidationParams struct {
	UserName    string
	LicenseType string
	ClassType   string
	Message     string
}

type SMTPConfig

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

SMTPConfig holds SMTP server configuration

func LoadSMTPConfig

func LoadSMTPConfig() *SMTPConfig

LoadSMTPConfig loads SMTP configuration from environment variables

func (*SMTPConfig) IsConfigured

func (c *SMTPConfig) IsConfigured() bool

IsConfigured returns true if SMTP is properly configured

type Sender

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

Sender sends emails via SMTP

func NewSender

func NewSender(config *SMTPConfig) *Sender

NewSender creates a new SMTP email sender

func (*Sender) Send

func (s *Sender) Send(to, subject, htmlBody string) error

Send sends an email.

Both `to` and the configured `From` address are parsed with net/mail.ParseAddress, which validates the address syntax and rejects CR/LF and other characters that could be used to inject additional headers (CWE-640). The subject is MIME Q-encoded so any non-ASCII or control bytes are escaped and cannot break out of the Subject header.

Jump to

Keyboard shortcuts

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