smtp

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: AGPL-3.0 Imports: 11 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 string, opts ...FormatMailOption) string

func SendEmail

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

Types

type FormatMailConfig added in v0.7.0

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

type FormatMailOption added in v0.7.0

type FormatMailOption func(c *FormatMailConfig)

func WithContentTransferEncoding added in v0.7.0

func WithContentTransferEncoding(contentTransferEncoding string) FormatMailOption

func WithContentType added in v0.7.0

func WithContentType(contentType string) FormatMailOption

func WithDate added in v0.7.0

func WithDate(date time.Time) FormatMailOption

func WithMimeVersion added in v0.7.0

func WithMimeVersion(mimeVersion string) FormatMailOption

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, opts ...FormatMailOption) 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