Documentation
¶
Overview ¶
Package notifications provides notification context and delivery management.
Index ¶
- func ApplyBranding(base string, baseIsHTML bool, identity *QueueIdentity, ctx *RenderContext) string
- func DefaultFallbacks(cfg *config.EmailConfig) (string, string)
- func DomainFromAddress(address string) string
- func EnvelopeAddress(identity *QueueIdentity, fallback string) string
- func HeaderAddress(identity *QueueIdentity, fallback string) string
- func SendEmail(to, subject, body string) error
- func SetEmailProvider(p EmailProvider)
- type EmailBranding
- type EmailMessage
- type EmailProvider
- type Hub
- type PendingReminder
- type QueueIdentity
- type RenderContext
- type SMTPProvider
- type Snippet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyBranding ¶
func ApplyBranding(base string, baseIsHTML bool, identity *QueueIdentity, ctx *RenderContext) string
ApplyBranding stitches salutation and signature around the base body and expands placeholders.
func DefaultFallbacks ¶
func DefaultFallbacks(cfg *config.EmailConfig) (string, string)
DefaultFallbacks returns sane defaults derived from the email config.
func DomainFromAddress ¶
DomainFromAddress extracts the domain portion of an email address.
func EnvelopeAddress ¶
func EnvelopeAddress(identity *QueueIdentity, fallback string) string
EnvelopeAddress picks the SMTP MAIL FROM value with fallback.
func HeaderAddress ¶
func HeaderAddress(identity *QueueIdentity, fallback string) string
HeaderAddress builds the From header with display name when present.
func SetEmailProvider ¶
func SetEmailProvider(p EmailProvider)
SetEmailProvider sets the global email provider.
Types ¶
type EmailBranding ¶
EmailBranding bundles outbound email metadata for queue-based messages.
func PrepareQueueEmail ¶
func PrepareQueueEmail(ctx context.Context, db *sql.DB, queueID int, baseBody string, baseIsHTML bool, cfg *config.EmailConfig, renderCtx *RenderContext) (*EmailBranding, error)
PrepareQueueEmail injects queue identity details into the outgoing body and headers.
type EmailProvider ¶
type EmailProvider interface {
Send(ctx context.Context, msg EmailMessage) error
}
func GetEmailProvider ¶
func GetEmailProvider() EmailProvider
GetEmailProvider returns the global email provider.
func NewSMTPProvider ¶
func NewSMTPProvider(cfg *config.EmailConfig) EmailProvider
type Hub ¶
type Hub interface {
Dispatch(ctx context.Context, recipients []int, reminder PendingReminder) error
Consume(userID int) []PendingReminder
}
func NewMemoryHub ¶
func NewMemoryHub() Hub
type PendingReminder ¶
type QueueIdentity ¶
type QueueIdentity struct {
QueueID int
Email string
DisplayName string
SalutationText string
SalutationContentType string
SignatureText string
SignatureContentType string
}
QueueIdentity captures outbound email metadata tied to a queue.
func ResolveQueueIdentity ¶
ResolveQueueIdentity loads queue-linked sender, salutation, and signature data.
func (*QueueIdentity) SalutationSnippet ¶
func (qi *QueueIdentity) SalutationSnippet() *Snippet
SalutationSnippet exposes the queue salutation as a snippet when present.
func (*QueueIdentity) SignatureSnippet ¶
func (qi *QueueIdentity) SignatureSnippet() *Snippet
SignatureSnippet exposes the queue signature as a snippet when present.
type RenderContext ¶
RenderContext carries values used to interpolate legacy placeholders.
func BuildRenderContext ¶
func BuildRenderContext(ctx context.Context, db *sql.DB, customerLogin string, agentID int) *RenderContext
BuildRenderContext fetches agent and customer names for placeholder interpolation.
type SMTPProvider ¶
type SMTPProvider struct {
// contains filtered or unexported fields
}
func (*SMTPProvider) Send ¶
func (s *SMTPProvider) Send(_ context.Context, msg EmailMessage) error