Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(email): skip send email when SMTP config is empty

LinkinStars95a57417c1be
diff --git a/internal/service/export/email_service.go b/internal/service/export/email_service.go
index 2812aa66..c886faee 100644
--- a/internal/service/export/email_service.go
+++ b/internal/service/export/email_service.go
@@ -106,6 +106,10 @@ func (es *EmailService) Send(ctx context.Context, toEmailAddr, subject, body str
log.Errorf("get email config failed: %s", err)
return
}
+ if len(ec.SMTPHost) == 0 {
+ log.Warnf("smtp host is empty, skip send email")
+ return
+ }
m := gomail.NewMessage()
fromName := mime.QEncoding.Encode("utf-8", ec.FromName)