From 56cca6be7cb3e15a99960c4e6c931081fd157d68 Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Thu, 26 May 2016 04:55:37 -0700 Subject: PLT-2976 Adding checkout for missing SMTP server when testing email connection (#3115) * PLT-2976 Adding checkout for missing SMTP server when testing email connection * Fixing unit test --- api/admin.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'api/admin.go') diff --git a/api/admin.go b/api/admin.go index 52e412976..096235a65 100644 --- a/api/admin.go +++ b/api/admin.go @@ -184,6 +184,11 @@ func testEmail(c *Context, w http.ResponseWriter, r *http.Request) { return } + if len(utils.Cfg.EmailSettings.SMTPServer) == 0 { + c.Err = model.NewLocAppError("testEmail", "api.admin.test_email.missing_server", nil, utils.T("api.context.invalid_param.app_error", map[string]interface{}{"Name": "SMTPServer"})) + return + } + if result := <-Srv.Store.User().Get(c.Session.UserId); result.Err != nil { c.Err = result.Err return -- cgit v1.2.3-1-g7c22