email

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 7 Imported by: 0 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

Overview

Catalog stock notifications: the commerce sends the platform offers out of the box. The service stays module-agnostic — the bucket details arrive as display-ready values composed by the caller.

Order email notifications: the commerce sends the platform offers out of the box. The service stays module-agnostic — item lines arrive as display-ready strings composed by the caller.

Payment email notifications: the commerce sends the platform offers out of the box. The service stays module-agnostic — the record details arrive as display-ready strings composed by the caller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailService

type EmailService interface {
	SendVerificationEmail(ctx context.Context, to, username, token string) error
	SendAccountLockoutEmail(ctx context.Context, to, username string) error
	SendRegistrationAttemptEmail(ctx context.Context, to, username string) error
	SendUserApprovedEmail(ctx context.Context, to, username string) error
	SendUserRejectedEmail(ctx context.Context, to, username string) error
	SendUserSuspendedEmail(ctx context.Context, to, username, reason string) error
	SendUserUnsuspendedEmail(ctx context.Context, to, username string) error
	SendUserSoftDeletedEmail(ctx context.Context, to, username, reason string) error
	SendEmailUpdateVerificationEmail(ctx context.Context, to, username, token string) error
	SendDataExportNotificationEmail(ctx context.Context, to, username string) error
	SendAccountDeletedNotification(ctx context.Context, to, username string) error
	SendAccountCreatedEmail(ctx context.Context, to, username, plainPassword string) error
	SendPasswordResetEmail(ctx context.Context, to, username, token string) error
	SendMFACodeEmail(ctx context.Context, to, username, code string) error
}

EmailService defines the interface for email operations

type ManualPayee added in v1.1.0

type ManualPayee struct {
	Bank    string
	Account string
	Name    string
}

ManualPayee is the destination account for manual bank transfers, adopted from the [payments.manual] config block. Empty means no payee block is configured and the confirmation email carries no How-to-pay section.

type OrderEmailItem added in v1.1.0

type OrderEmailItem struct {
	SKU       string
	Title     string
	Quantity  int
	UnitPrice string
	LineTotal string
}

OrderEmailItem is one purchase line of an order email. SKU and money amounts arrive as display-ready strings so the email service needs no commerce knowledge.

type SMTPConfig

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

SMTPConfig contains SMTP configuration

type Service

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

Service handles email sending operations

func NewService

func NewService(config SMTPConfig, logger *slog.Logger, baseURL string) *Service

NewService creates a new email service

func (*Service) IsEnabled

func (s *Service) IsEnabled() bool

IsEnabled returns whether the email service is enabled

func (*Service) SendAccountCreatedEmail

func (s *Service) SendAccountCreatedEmail(ctx context.Context, to, username, plainPassword string) error

SendAccountCreatedEmail sends a welcome email to a newly admin-created user with credentials

func (*Service) SendAccountDeletedNotification

func (s *Service) SendAccountDeletedNotification(ctx context.Context, to, username string) error

SendAccountDeletedNotification sends an account deletion notification email to a user

func (*Service) SendAccountLockoutEmail

func (s *Service) SendAccountLockoutEmail(ctx context.Context, to, username string) error

SendAccountLockoutEmail sends an account lockout notification email to a user

func (*Service) SendDataExportNotificationEmail

func (s *Service) SendDataExportNotificationEmail(ctx context.Context, to, username string) error

SendDataExportNotificationEmail sends a data export notification email to a user

func (*Service) SendEmailUpdateVerificationEmail

func (s *Service) SendEmailUpdateVerificationEmail(ctx context.Context, to, username, token string) error

SendEmailUpdateVerificationEmail sends an email update verification email to a user

func (*Service) SendLowStockAlert added in v1.1.0

func (s *Service) SendLowStockAlert(ctx context.Context, to string, contentID int, sku string, stock int, threshold int) error

SendLowStockAlert tells the operator one tracked bucket crossed its threshold downward.

func (*Service) SendMFACodeEmail added in v1.1.0

func (s *Service) SendMFACodeEmail(ctx context.Context, to, username, code string) error

SendMFACodeEmail sends the one-time login verification code to a user.

func (*Service) SendOrderConfirmationEmail added in v1.1.0

func (s *Service) SendOrderConfirmationEmail(ctx context.Context, to, orderNumber string, items []OrderEmailItem, subtotal string, shipping string, total string, payee ManualPayee, trackingToken string) error

SendOrderConfirmationEmail sends the confirmation for a just-placed order. A set payee appends the How-to-pay block; an empty payee sends the legacy body unchanged. A non-empty trackingToken appends the Track-your-order link built from the site base URL — the token is the order's guest key, so the email is the only place it is delivered.

func (*Service) SendOrderStatusEmail added in v1.1.0

func (s *Service) SendOrderStatusEmail(ctx context.Context, to, orderNumber, status string) error

SendOrderStatusEmail tells the customer one lifecycle move of their placed order, carrying the new status as its display string.

func (*Service) SendPasswordResetEmail

func (s *Service) SendPasswordResetEmail(ctx context.Context, to, username, token string) error

SendPasswordResetEmail sends a password reset email to a user

func (*Service) SendPaymentReceivedEmail added in v1.1.0

func (s *Service) SendPaymentReceivedEmail(ctx context.Context, to, orderNumber, method, reference, amount string) error

SendPaymentReceivedEmail confirms a submitted payment proof for a placed order.

func (*Service) SendPaymentRejectedEmail added in v1.1.0

func (s *Service) SendPaymentRejectedEmail(ctx context.Context, to, orderNumber, method, reference string) error

SendPaymentRejectedEmail tells the customer their proof could not be verified and how to correct it.

func (*Service) SendRegistrationAttemptEmail added in v1.1.0

func (s *Service) SendRegistrationAttemptEmail(ctx context.Context, to, username string) error

SendRegistrationAttemptEmail notifies an existing account holder that a registration attempt collided with their username or email. It backs the anti-enumeration registration contract: the requester always gets the same generic response, and the real owner is the one who finds out.

func (*Service) SendUserApprovedEmail

func (s *Service) SendUserApprovedEmail(ctx context.Context, to, username string) error

SendUserApprovedEmail sends an email when a user's registration is approved

func (*Service) SendUserRejectedEmail

func (s *Service) SendUserRejectedEmail(ctx context.Context, to, username string) error

SendUserRejectedEmail sends an email when a user's registration is rejected

func (*Service) SendUserSoftDeletedEmail

func (s *Service) SendUserSoftDeletedEmail(ctx context.Context, to, username, reason string) error

SendUserSoftDeletedEmail sends an email when a user's account is soft deleted

func (*Service) SendUserSuspendedEmail

func (s *Service) SendUserSuspendedEmail(ctx context.Context, to, username, reason string) error

SendUserSuspendedEmail sends an email when a user's account is suspended

func (*Service) SendUserUnsuspendedEmail

func (s *Service) SendUserUnsuspendedEmail(ctx context.Context, to, username string) error

SendUserUnsuspendedEmail sends an email when a user's account is unsuspended

func (*Service) SendVerificationEmail

func (s *Service) SendVerificationEmail(ctx context.Context, to, username, token string) error

SendVerificationEmail sends a verification email to a user

func (*Service) SetBaseURL

func (s *Service) SetBaseURL(baseURL string)

SetBaseURL sets the base URL for verification links

func (*Service) SetPrivacyPolicyURL added in v1.1.0

func (s *Service) SetPrivacyPolicyURL(url string)

SetPrivacyPolicyURL adopts the resolved privacy-policy link for the email footer. An empty URL leaves the footer unchanged: the store publishes no privacy policy, so there is nothing to link.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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