diff --git a/app/server.go b/app/server.go index 1126ff13c0..d0091ae94f 100644 --- a/app/server.go +++ b/app/server.go @@ -1196,8 +1196,11 @@ func (s *Server) Start() error { if err := s.Store.Status().ResetAll(); err != nil { mlog.Error("Error to reset the server status.", mlog.Err(err)) } - if err := mail.TestConnection(s.MailServiceConfig()); err != nil { - mlog.Error("Mail server connection test is failed", mlog.Err(err)) + + if s.MailServiceConfig().SendEmailNotifications { + if err := mail.TestConnection(s.MailServiceConfig()); err != nil { + mlog.Error("Mail server connection test failed", mlog.Err(err)) + } } err := s.FileBackend().TestConnection() diff --git a/shared/mail/mail.go b/shared/mail/mail.go index 8ca1db48bf..f30d10eb1a 100644 --- a/shared/mail/mail.go +++ b/shared/mail/mail.go @@ -208,10 +208,6 @@ func NewSMTPClient(ctx context.Context, conn net.Conn, config *SMTPConfig) (*smt } func TestConnection(config *SMTPConfig) error { - if !config.SendEmailNotifications { - return errors.New("SendEmailNotifications is not true") - } - conn, err := ConnectToSMTPServer(config) if err != nil { return errors.Wrap(err, "unable to connect")