常见 SMTP 服务器端口
QQ 5871632512625
需要开启邮箱的SMTP服务,知道smtp密码
控制器注册方法
// 发送激活邮件config := `{"username":"XXOO@","password":"smtp密码","host":"","port":25}`temail := utils.NewEMail(config)//指定收件人邮箱地址temail.To = []string{user.Email}//指定发件人的邮箱地址temail.From = "XXOO@"//指定邮件的标题temail.Subject = "用户激活"//指定邮件内容temail.HTML = "复制该连接到浏览器中激活 http://127.0.0.1:8080/active?id="+strconv.Itoa(user.Id)err = temail.Send()if err != nil {this.Data["errmsg"] = "发送激活邮件失败,请重新注册"this.TplName = "register.html"return}```