notifications

package
v0.0.0-...-e2efb3a Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMultipartMessage

func BuildMultipartMessage(fromAddress string, toAddresses []string, subject string, htmlBody string, textBody string) (string, error)

BuildMultipartMessage constructs a MIME multipart email message with both HTML and text parts

func SanitizeForEmail

func SanitizeForEmail(s string) string

SanitizeForEmail restricts to safe characters for email (alphanumerics, dash, dot, slash, colon, at, underscore). It removes any character not matching the safe set and explicitly strips CRLF characters to prevent header injection.

Types

type EmailClient

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

EmailClient wraps the SMTP client functionality

func ConnectSMTP

func ConnectSMTP(ctx context.Context, config models.EmailConfig) (*EmailClient, error)

ConnectSMTP establishes a connection to the SMTP server based on the TLS mode

func (*EmailClient) Close

func (ec *EmailClient) Close() error

Close closes the SMTP connection

func (*EmailClient) SendMessage

func (ec *EmailClient) SendMessage(fromAddress string, toAddresses []string, message string) error

SendMessage sends an email message through the SMTP client