email

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmailDisabled        = errors.New("email is disabled")
	ErrInvalidMailSender    = errors.New("invalid mail sender")
	ErrInvalidMailRecipient = errors.New("invalid mail recipient")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled        bool   `mapstructure:"enabled"`
	SendgridAPIKey string `mapstructure:"sendgrid_api_key"`
}

func (Config) LogValue

func (c Config) LogValue() slog.Value

func (Config) Validate

func (c Config) Validate() error

type EmailInfo

type EmailInfo struct {
	FromName  string // Name of the sender
	FromEmail string // Email of the sender
	ToName    string // Name of the recipient
	ToEmail   string // Email of the recipient
	Subject   string // Subject of the email
	HTMLBody  string // HTML body of the email
}

type EmailService

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

func NewEmailService

func NewEmailService(config *Config) *EmailService

func (*EmailService) IsEnabled

func (s *EmailService) IsEnabled() bool

func (*EmailService) Send

func (s *EmailService) Send(ctx context.Context, data *EmailInfo) error

type Service

type Service interface {
	IsEnabled() bool
	Send(ctx context.Context, data *EmailInfo) error
}

Service is the interface for the email service

Jump to

Keyboard shortcuts

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