email

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EmailSendTotal counts email send attempts by result.
	// Results: success, failure, dry_run, invalid_address.
	EmailSendTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "email_send_total",
			Help: "Total number of email send attempts.",
		},
		[]string{"result"},
	)

	// EmailSendDurationSeconds tracks SMTP send latency for delivered emails.
	EmailSendDurationSeconds = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "email_send_duration_seconds",
			Help:    "Latency of the SMTP send call in seconds (both successful and failed attempts).",
			Buckets: prometheus.DefBuckets,
		},
	)
)

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) IsConfigured added in v1.2.6

func (s *Sender) IsConfigured() bool

IsConfigured returns true when the sender has a usable SMTP configuration.

func (*Sender) Send

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

Send sends an email.

The recipient is validated with net/mail.ParseAddress (which rejects CR/LF and other header-injection vectors) and is delivered only through the SMTP envelope (the RCPT TO argument of smtp.SendMail). The user-controlled recipient is never concatenated into the message DATA headers, so it cannot 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.

type SignatureCompletedParams added in v1.2.9

type SignatureCompletedParams struct {
	OwnerName     string
	FlightSummary string
	SignerName    string
}

type SignatureRequestParams added in v1.2.9

type SignatureRequestParams struct {
	OwnerName     string
	FlightSummary string // e.g. "12 Jul 2026 — D-EFGH (C172), 1h24m"
	Link          string
	ExpiresAt     string
}

type VerifyEmailParams added in v1.2.5

type VerifyEmailParams struct {
	UserName string
	Link     string
}

Jump to

Keyboard shortcuts

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