Change resend to using smtp
All checks were successful
Build Backend (NixCN CMS) TeamCity build finished
Build Frontend (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-02 16:26:21 +08:00
parent a98ab26fa4
commit d70ade4907
7 changed files with 91 additions and 95 deletions

View File

@@ -6,8 +6,6 @@ import (
"nixcn-cms/pkgs/email"
"nixcn-cms/pkgs/turnstile"
log "github.com/sirupsen/logrus"
"github.com/gin-gonic/gin"
"github.com/spf13/viper"
)
@@ -59,13 +57,12 @@ func Magic(c *gin.Context) {
return
} else {
// Send email using resend
resend, err := email.NewResendClient()
emailClient, err := email.NewSMTPClient()
if err != nil {
log.Error(err)
c.JSON(500, gin.H{"status": "invalid email config"})
return
}
resend.Send(
emailClient.Send(
req.Email,
"NixCN CMS Email Verify",
"<p>Click the link below to verify your email. This link will expire in 10 minutes.</p><a href="+url.String()+">"+url.String()+"</a>",