Don't log error when SendEmailNotifications is set to false (#20007)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
lkyuchukov
2022-04-29 12:15:24 +03:00
коммит произвёл GitHub
родитель b6239243e7
Коммит 79a0d3dac4
2 изменённых файлов: 5 добавлений и 6 удалений

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

@@ -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()

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

@@ -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")