Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmailInvalidConfig = errors.New("invalid SMTP configuration") ErrEmailInvalidFrom = errors.New("invalid 'from' address") ErrEmailNoRecipients = errors.New("failed to provide one recipient") ErrEmailInvalidRecipient = errors.New("invalid 'recipient' address") ErrEmailSendFailed = errors.New("failed to send email") )
Functions ¶
func MockSMTPServerStart ¶
MockSMTPServerStart starts a mock SMTP server using the provided address. The server will signal on the ready channel when setup is complete.
Types ¶
type RedactedSMTPConfig ¶
type RedactedSMTPConfig SMTPConfig
RedactedSMTPConfig is a copy of SMTPConfig to hide sensitive information.
type SMTPConfig ¶
type SMTPConfig struct { Host string `required:"true"` // Host address. Port string `required:"true"` // Port number. Username string `required:"true"` // Username for authentication. Password string `required:"true"` // Password for authentication. }
SMTPConfig holds configuration for an SMTP server for sending emails.
func (SMTPConfig) IsValid ¶
func (s SMTPConfig) IsValid() (bool, error)
IsValid verifies that SMTPConfig has all required fields populated.
func (SMTPConfig) MarshalJSON ¶
func (s SMTPConfig) MarshalJSON() ([]byte, error)
MarshalJSON redacts sensitive information when marshalling to JSON.
func (SMTPConfig) SendMessage ¶
func (s SMTPConfig) SendMessage(from string, recipients []string, subject, body string) error
SendMessage sends an email using the configured SMTP server settings.
func (SMTPConfig) String ¶
func (s SMTPConfig) String() string
String returns a string for SMTPConfig with sensitive data redacted.
Click to show internal directories.
Click to hide internal directories.