by Robin at 20241015

This commit is contained in:
Leufolium 2024-10-15 16:02:08 +08:00
parent 63cf9f1b21
commit 57f1775a2c
3 changed files with 5 additions and 3 deletions

View File

@ -6,6 +6,8 @@ type EmailContentConfig struct {
}
type EmailInfoConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Address string `json:"address"`
Password string `json:"password"`
}

View File

@ -4059,7 +4059,7 @@ func (s *Service) ApiSendRavenIQTestResultAsEmail(ctx *gin.Context, req *emailpr
return
}
err = email.SendRavenIQTestResult(req.Email, emailInfoCfg.Address, emailInfoCfg.Password)
err = email.SendRavenIQTestResult(req.Email, emailInfoCfg.Host, emailInfoCfg.Port, emailInfoCfg.Address, emailInfoCfg.Password)
if err != nil {
logger.Error("SendRavenIQTestResult fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeEmailSrvFail

View File

@ -11,7 +11,7 @@ import (
"gopkg.in/gomail.v2"
)
func SendRavenIQTestResult(mail *dbstruct.Email, address, password string) error {
func SendRavenIQTestResult(mail *dbstruct.Email, host string, port int, address, password string) error {
url := mail.MediaComponent.Images[0].Urls[0]
format := mail.MediaComponent.Images[0].Fmt
@ -43,7 +43,7 @@ func SendRavenIQTestResult(mail *dbstruct.Email, address, password string) error
return err
}))
err = gomail.NewDialer("smtp.office365.com", 587, address, password).DialAndSend(m)
err = gomail.NewDialer(host, port, address, password).DialAndSend(m)
if err != nil {
logger.Error("Send Email Fail", err)
return err