email

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package email 邮件验证

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(mod string, db *orm.DB)

Types

type Email

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

func New

func New(s *web.Server, prefix orm.Prefix, db *orm.DB, expired time.Duration, smtp *SMTP) *Email

func (*Email) Delete

func (e *Email) Delete(tx *orm.Tx, uid int64) error

func (*Email) Identity

func (e *Email) Identity(uid int64) (string, bool)

func (*Email) Invalid

func (e *Email) Invalid(tx *orm.Tx, email, code string) error

Invalid 使指定的验证码无效

func (*Email) Send

func (e *Email) Send(tx *orm.Tx, email, code string) error

Send 发送验证码

func (*Email) Valid

func (e *Email) Valid(email, code string) (int64, string, bool)

type SMTP

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

func NewSMTP

func NewSMTP(subject, addr, from, template string, auth smtp.Auth) *SMTP

NewSMTP 新建 SMTP 对象

subject 为发送邮件的主题; addr 为 smtp 的主机地址,需要带上端口号; template 为邮件模板,可以有一个占位符 %%code%%;

Jump to

Keyboard shortcuts

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