email

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Index

Constants

View Source
const (
	TemplateActivation          = `<a href="javascript: void 0">点击这里激活</a>或使用激活码: %v`
	TemplateForgotPassword      = `<a href="javascript: void 0">点击连接重置密码</a>或使用重置码: %v`
	TemplateForgotTradePassword = `<a href="javascript: void 0">点击连接重置交易密码</a>或使用重置码: %v`
	TemplateAuth                = `正在验证您的身份,你的验证码是 %s`
	TemplateRegistry            = `<a href="%s" href="target">点击注册您的帐号</a>`
)

TODO: 重构邮箱模版

Variables

This section is empty.

Functions

func GetMailerConfig added in v0.4.0

func GetMailerConfig() (*model.ConfigFieldSMTP, error)

从数据库中获取邮箱设置

Types

type Mailer

type Mailer struct {
	Auth   *smtp.Auth
	Config model.ConfigFieldSMTP
}

func NewMailer

func NewMailer() (*Mailer, error)

func (*Mailer) Send

func (e *Mailer) Send(message *Message) (err error)

发送邮件

func (*Mailer) SendActivationEmail

func (e *Mailer) SendActivationEmail(toEmail string, code string) (err error)

发送激活邮件

func (*Mailer) SendAuthEmail

func (e *Mailer) SendAuthEmail(toEmail string, code string) (err error)

发送认证邮件

func (*Mailer) SendForgotPasswordEmail

func (e *Mailer) SendForgotPasswordEmail(toEmail string, code string) (err error)

发送忘记密码邮件

func (*Mailer) SendForgotTradePasswordEmail

func (e *Mailer) SendForgotTradePasswordEmail(toEmail string, code string) (err error)

发送忘记交易密码邮件

func (*Mailer) SendRegisterEmail

func (e *Mailer) SendRegisterEmail(toEmail string, redirectURL string) (err error)

发送注册邮件

type Message

type Message struct {
	ReplyTo     []string
	To          []string
	Bcc         []string
	Cc          []string
	Subject     string
	Text        []byte // Plaintext message (optional)
	HTML        []byte // Html message (optional)
	Sender      string // override From as SMTP envelope sender (optional)
	Headers     textproto.MIMEHeader
	Attachments []*email.Attachment
	ReadReceipt []string
}

Jump to

Keyboard shortcuts

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