email

package
v0.4.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSmtpPoolClosed = fmt.Errorf("smtp pool closed")

ProviderSet is service providers.

Functions

func FormatEmail added in v0.4.0

func FormatEmail(from string, to []string, subject string, body any) string

func SendEmail added in v0.4.0

func SendEmail(cli *smtp.Client, from string, to []string, subject, body string) error

Types

type EmailConsumer

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

func NewEmailConsumer

func NewEmailConsumer(ms *EmailService) *EmailConsumer

func (*EmailConsumer) Cleanup

func (*EmailConsumer) ConsumeClaim

func (s *EmailConsumer) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error

func (*EmailConsumer) Setup

type EmailService

type EmailService struct {
	emailApi.UnimplementedEmailServer
	// contains filtered or unexported fields
}

func NewEmailService

func NewEmailService(c *conf.EmailConfig) *EmailService

func (*EmailService) SendEmail

func (ms *EmailService) SendEmail(ctx context.Context, req *emailApi.SendEmailReq) (*emailApi.Empty, error)

type SmtpPool

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

func NewSmtpPool

func NewSmtpPool(c *conf.SmtpConfig, max int) (*SmtpPool, error)

func (*SmtpPool) Close added in v0.4.0

func (p *SmtpPool) Close()

func (*SmtpPool) Get

func (p *SmtpPool) Get() (*smtp.Client, error)

func (*SmtpPool) Put

func (p *SmtpPool) Put(cli *smtp.Client)

func (*SmtpPool) SendEmail added in v0.4.0

func (p *SmtpPool) SendEmail(to []string, subject, body string) error

func (*SmtpPool) SetFrom added in v0.4.0

func (p *SmtpPool) SetFrom(from string)

Jump to

Keyboard shortcuts

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