email

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDefaultProvider

func CreateDefaultProvider(cfg *config.EmailConfig, logger *zap.SugaredLogger) (types.Provider, error)

CreateDefaultProvider creates the default email provider from the email config

func CreateProvider

func CreateProvider(cfg config.EmailProviderSettings, logger *zap.SugaredLogger) (types.Provider, error)

CreateProvider creates an email provider instance based on the configuration

func CreateProviderByName

func CreateProviderByName(cfg *config.EmailConfig, name string, logger *zap.SugaredLogger) (types.Provider, error)

CreateProviderByName creates a specific email provider by name

func ExampleHealthCheck

func ExampleHealthCheck()

ExampleHealthCheck shows how to check if the email service is healthy

func ExampleUsage

func ExampleUsage()

ExampleUsage demonstrates how to use the email service

func ExampleWithSpecificProvider

func ExampleWithSpecificProvider()

ExampleWithSpecificProvider shows how to use a specific email provider

Types

type Service

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

Service provides email functionality

func NewService

func NewService(cfg *config.EmailConfig, logger *zap.SugaredLogger) (*Service, error)

NewService creates a new email service

func (*Service) Close

func (s *Service) Close() error

Close closes the email service and releases resources

func (*Service) GetConfig

func (s *Service) GetConfig() *config.EmailConfig

GetConfig returns the email configuration

func (*Service) IsEnabled

func (s *Service) IsEnabled() bool

IsEnabled returns true if the email service is enabled

func (*Service) IsHealthy

func (s *Service) IsHealthy(ctx context.Context) error

IsHealthy checks if the email service is healthy

func (*Service) Send

func (s *Service) Send(ctx context.Context, message *types.Message) (*types.SendResult, error)

Send sends an email using the default provider

func (*Service) SendTemplate

func (s *Service) SendTemplate(ctx context.Context, template string, data interface{}, message *types.Message) (*types.SendResult, error)

SendTemplate sends an email using a template

func (*Service) SendWithProvider

func (s *Service) SendWithProvider(ctx context.Context, providerName string, message *types.Message) (*types.SendResult, error)

SendWithProvider sends an email using a specific provider

func (*Service) UseTemplate

func (s *Service) UseTemplate(templateName string, data map[string]interface{}) (htmlContent, textContent string, err error)

UseTemplate renders a template with the given data and returns both HTML and text versions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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