Documentation
¶
Index ¶
- func CreateDefaultProvider(cfg *config.EmailConfig, logger *zap.SugaredLogger) (types.Provider, error)
- func CreateProvider(cfg config.EmailProviderSettings, logger *zap.SugaredLogger) (types.Provider, error)
- func CreateProviderByName(cfg *config.EmailConfig, name string, logger *zap.SugaredLogger) (types.Provider, error)
- func ExampleHealthCheck()
- func ExampleUsage()
- func ExampleWithSpecificProvider()
- type Service
- func (s *Service) Close() error
- func (s *Service) GetConfig() *config.EmailConfig
- func (s *Service) IsEnabled() bool
- func (s *Service) IsHealthy(ctx context.Context) error
- func (s *Service) Send(ctx context.Context, message *types.Message) (*types.SendResult, error)
- func (s *Service) SendTemplate(ctx context.Context, template string, data interface{}, message *types.Message) (*types.SendResult, error)
- func (s *Service) SendWithProvider(ctx context.Context, providerName string, message *types.Message) (*types.SendResult, error)
- func (s *Service) UseTemplate(templateName string, data map[string]interface{}) (htmlContent, textContent string, err error)
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 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) GetConfig ¶
func (s *Service) GetConfig() *config.EmailConfig
GetConfig returns the email configuration
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
Click to show internal directories.
Click to hide internal directories.