email

package
v0.0.0-...-0eef1dd Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMailMsg

func BuildMailMsg(msg Message) (*mail.Msg, error)

BuildMailMsg build *mail.Msg from Message

func TmplConfirmCode

func TmplConfirmCode(usage, name, code string, ttl time.Duration) hermes.Email

Types

type Consumer

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

Consumer is responsible for reading messages from queues and then send these emails.

func (*Consumer) Consume

func (c *Consumer) Consume(ctx context.Context) error

type Handler

type Handler struct {
	Cfg conf.Email
	// contains filtered or unexported fields
}

Handler is email handler

func NewEmailHandler

func NewEmailHandler(cfg conf.Email, client *mail.Client, queue mq.Queue) (*Handler, error)

func (*Handler) SendEmail

func (h *Handler) SendEmail(ctx context.Context, msg Message) error

func (*Handler) SendHermesEmail

func (h *Handler) SendHermesEmail(ctx context.Context, subject string, to []string, email hermes.Email) error

type Message

type Message struct {
	ContentType mail.ContentType `mapstructure:"contentType"`
	From        string           `mapstructure:"from"`
	To          []string         `mapstructure:"to"`
	CC          []string         `mapstructure:"cc"`
	Bcc         []string         `mapstructure:"bcc"`
	Subject     string           `mapstructure:"subject"`
	Body        string           `mapstructure:"body"`
}

Message represents an email message

type Publisher

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

Publisher store email message into queue and then return right now

func (*Publisher) Publish

func (s *Publisher) Publish(ctx context.Context, msg Message) error

Publish publishes email message

Jump to

Keyboard shortcuts

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