email

package module
v0.0.0-...-7a12048 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 9 Imported by: 1

README

email

send email using http API

usage

curl -XPOST 127.0.0.1:8000/mailto \
-H "content-type: application/json" \
-d '{
	"mailto": "lmr@epurs.com",
	"subject": "test subject",
	"body": "测试发送成功!"
}'

Documentation

Index

Constants

View Source
const (
	ID            = "email"
	Comment       = "send email using http"
	RoutePrefix   = "/"
	DefaultEnable = false
)

Variables

View Source
var Module = module.Module{
	ID:      ID,
	Comment: Comment,

	RouteFunc:   AddRoute,
	RoutePrefix: RoutePrefix,

	FlagFunc: ServeFlag,
}

Functions

func AddRoute

func AddRoute(g *gin.Engine)

func Mailto

func Mailto(letter *Letter) error

Mailto 发送电子邮件

func SendMail

func SendMail(c *gin.Context)

func ServeFlag

func ServeFlag(serveCmd *cobra.Command)

Types

type Letter

type Letter struct {
	Mailto  string `json:"mailto" form:"mailto" validate:"required"`
	Subject string `json:"subject" form:"subject" validate:"required"`
	Body    string `json:"body" form:"body" validate:"required"`
}

type Mailer

type Mailer struct {
	Username       string `validate:"email"`
	Password       string
	SmtpServer     string
	SmtpServerPort string
}

func NewMailer

func NewMailer() *Mailer

type MailerInterface

type MailerInterface interface {
	SendMail(c *gin.Context)
}

Jump to

Keyboard shortcuts

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