mail

package
v0.0.0-...-ebca6f7 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const TempForgetPassword = `
您的账号{{.Username}}正在重置密码,验证码为 {{.Code}},有效期15分钟!
`
View Source
const TempRegister = `
您好{{.Username}},欢迎注册我的博客平台。您的验证码为 {{.Code}},有效期15分钟!
`
View Source
const TempSimpleCode = `` /* 4417-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptchaEmail

type CaptchaEmail struct {
	Username string `json:"username"`
	Code     string `json:"code"`
}

验证码邮件内容

type EmailContent

type EmailContent struct {
	Title       string `json:"title"`        // 标题
	HeadBg      string `json:"head_bg"`      // 头部背景图
	HeadTips    string `json:"head_tips"`    // 头部提示
	DearUser    string `json:"dear"`         // 亲爱的用户
	Content     string `json:"content"`      // 内容
	ButtonTips  string `json:"button_tips"`  // 按钮提示
	ButtonLink  string `json:"button_url"`   // 按钮链接
	ContactUs   string `json:"contact_us"`   // 联系我们
	ContactLink string `json:"contact_link"` // 联系链接
}

func NewEmailContent

func NewEmailContent() *EmailContent

type EmailMessage

type EmailMessage struct {
	To      []string `json:"to"`      // 目标邮箱号
	Subject string   `json:"subject"` // 主题
	Content string   `json:"content"` // 内容
	Type    int      `json:"type"`    // 0:普通邮件 1:需要抄送
}

type EmailSender

type EmailSender struct {
	Host     string   // 服务器地址
	Port     int      // 端口
	Username string   // 发件人
	Password string   // 密钥
	Nickname string   // 发件人昵称
	Deliver  []string // 抄送邮箱:多个以英文逗号分隔
	IsSSL    bool     // 是否使用 SSL/TLS
}

func NewEmailSender

func NewEmailSender(opts ...Option) *EmailSender

func (*EmailSender) SendEmailMessage

func (s *EmailSender) SendEmailMessage(message EmailMessage) error

type Option

type Option func(*EmailSender)

func WithDeliver

func WithDeliver(deliver []string) Option

func WithHost

func WithHost(host string) Option

func WithIsSSL

func WithIsSSL(isSSL bool) Option

func WithNickname

func WithNickname(nickname string) Option

func WithPassword

func WithPassword(password string) Option

func WithPort

func WithPort(port int) Option

func WithUsername

func WithUsername(username string) Option

Jump to

Keyboard shortcuts

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