This commit is contained in:
2025-02-27 15:05:34 +08:00
parent 3f85158eed
commit be0db326b9
58 changed files with 1779 additions and 361 deletions

View File

@ -45,7 +45,7 @@ func CheckIsEmail(email string) bool {
}
// SendFrontedEmail 发送邮件
func SendFrontedEmail(toEmail string, code string) error {
func SendFrontedEmail(toEmail string, code string, subject, body string) error {
// 邮箱配置
from := config.ExtConfig.EmailConfig.MailFrom // 发送者邮箱
password := config.ExtConfig.EmailConfig.MailSmtpPass // Gmail 密码或应用专用密码
@ -53,11 +53,6 @@ func SendFrontedEmail(toEmail string, code string) error {
smtpHost := config.ExtConfig.EmailConfig.MailSmtpHost // Gmail SMTP 服务器
smtpPort := config.ExtConfig.EmailConfig.MailSmtpPort // SMTP 端口
link := fmt.Sprintf("%s/verify?email=%s&verify_code=%s&type=register", config.ExtConfig.Domain, toEmail, code)
// 创建邮件消息
subject := "注册验证"
body := fmt.Sprintf("<h1>注册验证</h1><p>您收到此电子邮件,用于进行邮箱验证,请点击下面的链接或打开下面的网址继续。 <p>You have received this email for email verification, please click the link below or open the URL below to continue.</p> %s </p>", link)
m := gomail.NewMessage()
m.SetHeader("From", from) // 发件人
m.SetHeader("To", to) // 收件人