mail

package
v0.0.0-...-42ebea8 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUninitialized = errors.New("smtp 未初始化")

Functions

func DialSmtp

func DialSmtp(addr string) (*smtp.Client, error)

DialSmtp return a smtp client

func Init

func Init(config SmtpConfig) error

func MailTo

func MailTo(to string, subject string, body string) error

func SendMailWithTLS

func SendMailWithTLS(addr string, auth smtp.Auth, from string,
	to []string, msg []byte) (err error)

SendMailWithTLS send email with tls

func Smtp

func Smtp(config *SmtpConfig, to string, subject string, body string) error

Types

type SmtpConfig

type SmtpConfig struct {
	Host     string `json:"host" toml:"host"`
	Port     int    `json:"port" toml:"port"`
	From     string `json:"from" toml:"from"`         // 控制台创建的发信地址
	Password string `json:"password" toml:"password"` // 控制台设置的SMTP密码
}

Jump to

Keyboard shortcuts

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