mail

package
v0.0.0-...-b32e05d Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const TempBind = `
您好{{.Username}},您的账号正在尝试修改绑定邮箱。您的验证码为 {{.Code}},有效期15分钟!
`
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 EmailDeliver

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

func NewEmailDeliver

func NewEmailDeliver(opts ...Option) *EmailDeliver

func (*EmailDeliver) DeliveryEmail

func (s *EmailDeliver) DeliveryEmail(message *EmailMessage) error

type EmailMessage

type EmailMessage struct {
	To      []string `json:"to"`      // 目标邮箱号
	Subject string   `json:"subject"` // 主题
	Content string   `json:"content"` // 内容
	CC      bool     `json:"cc"`      // 是否抄送
}

type IEmailDeliver

type IEmailDeliver interface {
	DeliveryEmail(message *EmailMessage) error
}

投递邮件

type MqEmailDeliver

type MqEmailDeliver struct {
	Deliver *EmailDeliver

	Publisher  mq.MessagePublisher
	Subscriber mq.MessageSubscriber
}

func NewMqEmailDeliver

func NewMqEmailDeliver(deliver *EmailDeliver, pb mq.MessagePublisher, sb mq.MessageSubscriber) *MqEmailDeliver

func (*MqEmailDeliver) DeliveryEmail

func (m *MqEmailDeliver) DeliveryEmail(msg *EmailMessage) error

func (*MqEmailDeliver) SubscribeEmail

func (m *MqEmailDeliver) SubscribeEmail()

type Option

type Option func(*EmailDeliver)

func WithDeliver

func WithDeliver(deliver []string) Option

func WithHost

func WithHost(host string) 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