@@ -10,7 +10,7 @@
|
|||||||
"ServiceSettings": {
|
"ServiceSettings": {
|
||||||
"SiteName": "Mattermost Preview",
|
"SiteName": "Mattermost Preview",
|
||||||
"Domain": "",
|
"Domain": "",
|
||||||
"Mode" : "prod",
|
"Mode" : "dev",
|
||||||
"AllowTesting" : false,
|
"AllowTesting" : false,
|
||||||
"UseSSL": false,
|
"UseSSL": false,
|
||||||
"Port": "8065",
|
"Port": "8065",
|
||||||
|
|||||||
@@ -40,23 +40,27 @@ func SendMail(to, subject, body string) *model.AppError {
|
|||||||
|
|
||||||
auth := smtp.PlainAuth("", Cfg.EmailSettings.SMTPUsername, Cfg.EmailSettings.SMTPPassword, host)
|
auth := smtp.PlainAuth("", Cfg.EmailSettings.SMTPUsername, Cfg.EmailSettings.SMTPPassword, host)
|
||||||
|
|
||||||
|
var conn net.Conn
|
||||||
|
var err error
|
||||||
|
|
||||||
if Cfg.EmailSettings.UseTLS {
|
if Cfg.EmailSettings.UseTLS {
|
||||||
tlsconfig := &tls.Config{
|
tlsconfig := &tls.Config{
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
ServerName: host,
|
ServerName: host,
|
||||||
}
|
}
|
||||||
|
|
||||||
conn, err := tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig)
|
conn, err = tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewAppError("SendMail", "Failed to open TLS connection", err.Error())
|
return model.NewAppError("SendMail", "Failed to open TLS connection", err.Error())
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
} else {
|
||||||
|
conn, err = net.Dial("tcp", Cfg.EmailSettings.SMTPServer)
|
||||||
|
if err != nil {
|
||||||
|
return model.NewAppError("SendMail", "Failed to open connection", err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
conn, err := net.Dial("tcp", Cfg.EmailSettings.SMTPServer)
|
defer conn.Close()
|
||||||
if err != nil {
|
|
||||||
return model.NewAppError("SendMail", "Failed to open connection", err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
c, err := smtp.NewClient(conn, host)
|
c, err := smtp.NewClient(conn, host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user