[MM-17797] Add Timeout To SMTP Connection (#13251)

* model/config: add timeout setting to email settings

* services/mailservice: add timeout to connection

* app/server_app_adapter: show SMTP connection errors on log

* services/mailservice: add r/w deadline to smtp conn

* services/mailservice: add context timeout

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2020-03-10 18:34:31 +03:00
коммит произвёл GitHub
родитель 8327e9b0ba
Коммит 771574b652
4 изменённых файлов: 113 добавлений и 26 удалений

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

@@ -1245,6 +1245,7 @@ type EmailSettings struct {
SMTPPassword *string `restricted:"true"`
SMTPServer *string `restricted:"true"`
SMTPPort *string `restricted:"true"`
SMTPServerTimeout *int
ConnectionSecurity *string `restricted:"true"`
SendPushNotifications *bool
PushNotificationServer *string
@@ -1325,6 +1326,10 @@ func (s *EmailSettings) SetDefaults(isUpdate bool) {
s.SMTPPort = NewString("10025")
}
if s.SMTPServerTimeout == nil || *s.SMTPServerTimeout == 0 {
s.SMTPServerTimeout = NewInt(10)
}
if s.ConnectionSecurity == nil || *s.ConnectionSecurity == CONN_SECURITY_PLAIN {
s.ConnectionSecurity = NewString(CONN_SECURITY_NONE)
}