smtp

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func FormatMail

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

func SendEmail

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

Types

type SmtpConfig

type SmtpConfig struct {
	Host     string
	Port     uint32
	Protocol string
	Username string
	Password string
	From     string
}

type SmtpPool

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

func NewSmtpPool

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

func (*SmtpPool) Close

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

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

func (*SmtpPool) SetFrom

func (p *SmtpPool) SetFrom(from string)

Jump to

Keyboard shortcuts

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