diff options
-rw-r--r-- | api/team.go | 5 | ||||
-rw-r--r-- | utils/config.go | 1 | ||||
-rw-r--r-- | utils/mail.go | 23 | ||||
-rw-r--r-- | web/react/components/user_settings/user_settings_notifications.jsx | 2 |
4 files changed, 28 insertions, 3 deletions
diff --git a/api/team.go b/api/team.go index 4794b66df..fba4b41c6 100644 --- a/api/team.go +++ b/api/team.go @@ -75,7 +75,10 @@ func signupTeam(c *Context, w http.ResponseWriter, r *http.Request) { return } - m["follow_link"] = bodyPage.Props["Link"] + if !utils.Cfg.EmailSettings.RequireEmailVerification { + m["follow_link"] = bodyPage.Props["Link"] + } + w.Header().Set("Access-Control-Allow-Origin", " *") w.Write([]byte(model.MapToJson(m))) } diff --git a/utils/config.go b/utils/config.go index 5d786699b..764c81e0d 100644 --- a/utils/config.go +++ b/utils/config.go @@ -151,6 +151,7 @@ func LoadConfig(fileName string) { } configureLog(&config.LogSettings) + TestConnection(&config) Cfg = &config SanitizeOptions = getSanitizeOptions(Cfg) diff --git a/utils/mail.go b/utils/mail.go index dd975155d..f6fe1ce00 100644 --- a/utils/mail.go +++ b/utils/mail.go @@ -65,13 +65,34 @@ func newSMTPClient(conn net.Conn, config *model.Config) (*smtp.Client, *model.Ap return c, nil } +func TestConnection(config *model.Config) { + if !config.EmailSettings.SendEmailNotifications { + return + } + + conn, err1 := connectToSMTPServer(config) + if err1 != nil { + l4g.Error("SMTP server settings do not appear to be configured properly err=%v details=%v", err1.Message, err1.DetailedError) + return + } + defer conn.Close() + + c, err2 := newSMTPClient(conn, config) + if err2 != nil { + l4g.Error("SMTP connection settings do not appear to be configured properly err=%v details=%v", err2.Message, err2.DetailedError) + return + } + defer c.Quit() + defer c.Close() +} + func SendMail(to, subject, body string) *model.AppError { return SendMailUsingConfig(to, subject, body, Cfg) } func SendMailUsingConfig(to, subject, body string, config *model.Config) *model.AppError { - if !config.EmailSettings.SendEmailNotifications { + if !config.EmailSettings.SendEmailNotifications || len(config.EmailSettings.SMTPServer) == 0 { return nil } diff --git a/web/react/components/user_settings/user_settings_notifications.jsx b/web/react/components/user_settings/user_settings_notifications.jsx index ba14f019f..42c65ef5d 100644 --- a/web/react/components/user_settings/user_settings_notifications.jsx +++ b/web/react/components/user_settings/user_settings_notifications.jsx @@ -420,7 +420,7 @@ export default class NotificationsTab extends React.Component { </label> <br/> </div> - <div><br/>{'Email notifications are sent for mentions and direct messages after you have been away from ' + global.window.config.SiteName + ' for 5 minutes.'}</div> + <div><br/>{'Email notifications are sent for mentions and direct messages after you’ve been offline for more than 60 seconds or away from ' + global.window.config.SiteName + ' for more than 5 minutes.'}</div> </div> ); |