smtp

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	USAGE_SIGNUP = "signup"
	USAGE_FORGET = "forgetpwd"
)
View Source
var SMTPWireSet = wire.NewSet(
	GetConfig,
	NewSMTPServer,
)

Functions

func Dial

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

func SendMailUsingTLS

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

Types

type Config

type Config struct {
	Secret string `env:"ILLA_SECRET_KEY" envDefault:"ausNV5NJfVCrz3tPXtW2ZGGCpUuWFVQbikZ6d7FyOfpw9RcyLiNpqx4pJ6fSX9JXhMfmIupKKjQElURR"`
}

func GetConfig

func GetConfig() (*Config, error)

type SMTPServer

type SMTPServer struct {
	Secret string
}

func NewSMTPServer

func NewSMTPServer(cfg *Config) SMTPServer

func (*SMTPServer) NewVerificationCode

func (s *SMTPServer) NewVerificationCode(email, usage string) (string, error)

func (*SMTPServer) SendSubscriptionEmail

func (s *SMTPServer) SendSubscriptionEmail(email string) error

func (*SMTPServer) ValidateVerificationCode

func (s *SMTPServer) ValidateVerificationCode(codeToken, vCode, email, usage string) (bool, error)

type VCodeClaims

type VCodeClaims struct {
	Email string `json:"email"`
	Code  string `json:"code"`
	Usage string `json:"usage"`
	jwt.RegisteredClaims
}

Jump to

Keyboard shortcuts

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