package v2 import ( "github.com/gin-gonic/gin" "kefu/lib" "kefu/types" ) func PostEmailCode(c *gin.Context) { email := c.PostForm("email") notify := &lib.Notify{ Subject: "测试主题", MainContent: "测试内容", EmailServer: lib.NotifyEmail{ Server: "xxx", Port: 587, From: "xxx", Password: "xxx", To: []string{email}, FromName: "xxx", }, } _, err := notify.SendMail() if err != nil { c.JSON(200, gin.H{ "code": types.ApiCode.FAILED, "msg": types.ApiCode.GetMessage(types.ApiCode.FAILED), }) return } c.JSON(200, gin.H{ "code": types.ApiCode.SUCCESS, "msg": types.ApiCode.GetMessage(types.ApiCode.SUCCESS), }) return }