diff --git a/server/auth/internal/logic/email_manager.go b/server/auth/internal/logic/email_manager.go index 57ad20cb..3c95563c 100644 --- a/server/auth/internal/logic/email_manager.go +++ b/server/auth/internal/logic/email_manager.go @@ -5,10 +5,10 @@ import ( "fmt" "fusenapi/utils/check" "fusenapi/utils/fstpl" + "html/template" "log" "net/smtp" "sync" - "text/template" "time" "github.com/zeromicro/go-zero/core/logx" diff --git a/server/auth/internal/logic/websocket_test.go b/server/auth/internal/logic/websocket_test.go index 812ab97e..69d779a6 100644 --- a/server/auth/internal/logic/websocket_test.go +++ b/server/auth/internal/logic/websocket_test.go @@ -7,6 +7,7 @@ import ( "io" "log" "net/http" + "net/smtp" "testing" "github.com/474420502/requests" @@ -16,6 +17,113 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) +func TestEmailSend(t *testing.T) { + + // 设置发件人和收件人信息 + from := "support@fusenpack.com" + to := []string{"474420502@qq.com"} + + // 设置smtp服务器地址,端口和认证信息 + smtpServer := "smtp.gmail.com" + + auth := smtp.PlainAuth("", "support@fusenpack.com", "wfbjpdgvaozjvwah", smtpServer) + + body := `
+
+
+
+ |
+
+
+ 3e
+
+
+ 474420502@qq.com
+
+ |
+