email

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSenderConfigSection SenderConfigSection = "email-sender"
	DefaultPusherConfigSection PusherConfigSection = "email-pusher"
	DefaultRedisQueueKey                           = "email-verify"
)

Variables

View Source
var MsgSerializer = encoding.JSONSerializer

Functions

func GetPusherProvider

func GetPusherProvider(
	pusherConfig PusherConfigSection,
	redisConfig redis.ConfigSection,
	redisKey RedisQueueKey,
) *ioc.Provider[*Pusher]

func GetSenderProvider

func GetSenderProvider(
	senderConfig SenderConfigSection,
	redisConfig redis.ConfigSection,
	redisKey RedisQueueKey,
) *ioc.Provider[*Sender]

func SendEmail

func SendEmail(title, from, pass, host, port, to, subject, body string) error

Types

type Msg

type Msg struct {
	Email string
	Data  map[string]interface{}
}

type Pusher

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

func GetPusher

func GetPusher(c *ioc.Container) *Pusher

func NewPusher

func NewPusher(mq queue.Queue[Msg]) *Pusher

func (*Pusher) Push

func (p *Pusher) Push(ctx context.Context, email string, data map[string]interface{}, expire time.Duration) error

type PusherConfig

type PusherConfig struct {
	Levels map[healthy.Level]int64 `mapstructure:"levels"`
}

func (*PusherConfig) GetError

func (c *PusherConfig) GetError(queueLength int64) *healthy.Error

type PusherConfigSection

type PusherConfigSection string

type RedisQueueKey

type RedisQueueKey string

type Sender

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

func GetSender

func GetSender(c *ioc.Container) *Sender

func NewSender

func NewSender(mq queue.Queue[Msg]) *Sender

func (*Sender) Run

func (s *Sender) Run(ctx context.Context, handler func(err error))

func (*Sender) UpdateConfig

func (s *Sender) UpdateConfig(opts *SenderConfig) error

type SenderConfig

type SenderConfig struct {
	Title    string `mapstructure:"title"`
	From     string `mapstructure:"from"`
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	Password string `mapstructure:"password"`
	Template string `mapstructure:"template"`
	Subject  string `mapstructure:"subject"`
}

type SenderConfigSection

type SenderConfigSection string

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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