Merge pull request 'by Robin at 20241015' (#753) from feat-IRONFANS-210-Robin into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/753
This commit is contained in:
chenhao 2024-10-15 16:02:45 +08:00
commit 7372af7040
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

@ -4274,7 +4274,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