by Robin at 20241015
This commit is contained in:
parent
63cf9f1b21
commit
57f1775a2c
|
@ -6,6 +6,8 @@ type EmailContentConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type EmailInfoConfig struct {
|
type EmailInfoConfig struct {
|
||||||
|
Host string `json:"host"`
|
||||||
|
Port int `json:"port"`
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -4059,7 +4059,7 @@ func (s *Service) ApiSendRavenIQTestResultAsEmail(ctx *gin.Context, req *emailpr
|
||||||
return
|
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 {
|
if err != nil {
|
||||||
logger.Error("SendRavenIQTestResult fail, req: %v, err: %v", util.ToJson(req), err)
|
logger.Error("SendRavenIQTestResult fail, req: %v, err: %v", util.ToJson(req), err)
|
||||||
ec = errcode.ErrCodeEmailSrvFail
|
ec = errcode.ErrCodeEmailSrvFail
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"gopkg.in/gomail.v2"
|
"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]
|
url := mail.MediaComponent.Images[0].Urls[0]
|
||||||
format := mail.MediaComponent.Images[0].Fmt
|
format := mail.MediaComponent.Images[0].Fmt
|
||||||
|
@ -43,7 +43,7 @@ func SendRavenIQTestResult(mail *dbstruct.Email, address, password string) error
|
||||||
return err
|
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 {
|
if err != nil {
|
||||||
logger.Error("Send Email Fail", err)
|
logger.Error("Send Email Fail", err)
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue