Documentation
¶
Overview ¶
Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Index ¶
- type Builder
- func (b *Builder) NotifyAccountDeleted(sysName, support string) string
- func (b *Builder) NotifyOldEmail(sysName, support string) string
- func (b *Builder) VerificationChangeEmail(callback, code string) string
- func (b *Builder) VerificationDeleteAccount(sysName, support, callback, code string) string
- func (b *Builder) VerificationEmail(callback, code string) string
- type Config
- type SMTPClient
- type Sender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶ added in v1.6.6
type Builder struct {
// contains filtered or unexported fields
}
Builder constructs HTML email bodies for verification and notification emails. It holds the base domain used for building verification links.
func NewBuilder ¶ added in v1.6.6
NewBuilder creates a new Builder with the given domain as the base URL. The domain should include scheme (e.g., https://example.com) and optionally a trailing slash.
func (*Builder) NotifyAccountDeleted ¶ added in v1.6.6
NotifyAccountDeleted returns an HTML email body notifying the user that their account has been deleted. 'sysName' is the system name, 'support' is the support email for reporting unauthorized deletion.
func (*Builder) NotifyOldEmail ¶ added in v1.6.6
NotifyOldEmail returns an HTML email body notifying the user at their old email address that their account email was changed. 'sysName' is the name of the system or application. 'support' is the support email address to contact if the change was unauthorized.
func (*Builder) VerificationChangeEmail ¶ added in v1.6.6
VerificationChangeEmail returns an HTML email body for verifying a user's new email address after an email change. 'callback' is the verification endpoint path appended to the domain. 'code' is the unique verification code appended as a query parameter.
func (*Builder) VerificationDeleteAccount ¶ added in v1.6.6
VerificationDeleteAccount returns an HTML email body for verifying a user's account deletion request. 'sysName' is the system name, 'support' is the support email, 'callback' is the endpoint path, and 'code' is the unique verification code.
func (*Builder) VerificationEmail ¶ added in v1.6.6
VerificationEmail returns an HTML email body for verifying a user's email address after registration. 'callback' is the verification endpoint path appended to the domain. 'code' is the unique verification code appended as a query parameter.
type Config ¶
type Config struct {
Host string // SMTP server host
Port string // SMTP server port
Username string // SMTP username for authentication
Password string // SMTP password or token for authentication
From string // Default "From" email address
}
Config holds SMTP configuration for sending emails.
func (*Config) WithFrom ¶
WithFrom sets the default "From" email address and returns the updated Config.
func (*Config) WithPassword ¶
WithPassword sets the SMTP password and returns the updated Config.
func (*Config) WithUsername ¶
WithUsername sets the SMTP username and returns the updated Config.
type SMTPClient ¶ added in v1.6.6
type SMTPClient struct {
// contains filtered or unexported fields
}
func NewSMTPClient ¶ added in v1.6.6
func NewSMTPClient(cfg *Config) (*SMTPClient, error)
func (*SMTPClient) Send ¶ added in v1.6.6
func (s *SMTPClient) Send(to, subject, body string) error