Add support for SMTP servers with StartTLS

Этот коммит содержится в:
Jirka Hlavacek
2015-08-19 09:03:55 +02:00
родитель 7004a348b5
Коммит 3c58e283b6
6 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@@ -73,7 +73,8 @@
"SMTPUsername": "",
"SMTPPassword": "",
"SMTPServer": "",
"UseTLS": false,
"UseTLS": false,
"UseStartTLS": false,
"FeedbackEmail": "",
"FeedbackName": "",
"ApplePushServer": "",

Просмотреть файл

@@ -64,6 +64,7 @@
"SMTPPassword": "",
"SMTPServer": "",
"UseTLS": false,
"UseStartTLS": false,
"FeedbackEmail": "",
"FeedbackName": "",
"ApplePushServer": "",

Просмотреть файл

@@ -64,6 +64,7 @@
"SMTPPassword": "",
"SMTPServer": "",
"UseTLS": false,
"UseStartTLS": false,
"FeedbackEmail": "",
"FeedbackName": "",
"ApplePushServer": "",

Просмотреть файл

@@ -64,6 +64,7 @@
"SMTPPassword": "",
"SMTPServer": "",
"UseTLS": false,
"UseStartTLS": false,
"FeedbackEmail": "",
"FeedbackName": "",
"ApplePushServer": "",

Просмотреть файл

@@ -85,6 +85,7 @@ type EmailSettings struct {
SMTPPassword string
SMTPServer string
UseTLS bool
UseStartTLS bool
FeedbackEmail string
FeedbackName string
ApplePushServer string

Просмотреть файл

@@ -73,6 +73,12 @@ func newSMTPClient(conn net.Conn) (*smtp.Client, *model.AppError) {
if err = c.Auth(auth); err != nil {
return nil, model.NewAppError("SendMail", "Failed to authenticate on SMTP server", err.Error())
}
} else if Cfg.EmailSettings.UseStartTLS {
tlsconfig := &tls.Config{
InsecureSkipVerify: true,
ServerName: host,
}
c.StartTLS(tlsconfig)
}
return c, nil
}