diff --git a/apollostruct/emailconfig.go b/apollostruct/emailconfig.go index b5b4d46d..95db6358 100644 --- a/apollostruct/emailconfig.go +++ b/apollostruct/emailconfig.go @@ -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"` } diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 8a6450f5..715a96dd 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -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 diff --git a/library/email/send.go b/library/email/send.go index 49c3613d..c44ee9e3 100644 --- a/library/email/send.go +++ b/library/email/send.go @@ -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