Add a check for zero SMTP config

This commit is contained in:
Kailash Nadh 2020-06-05 17:00:11 +05:30
parent 67eb3dbbbe
commit 3048ab5afb
1 changed files with 3 additions and 0 deletions

View File

@ -236,6 +236,9 @@ func initMessengers(m *manager.Manager) messenger.Messenger {
srv = append(srv, s) srv = append(srv, s)
lo.Printf("loaded SMTP: %s (%s@%s)", s.Name, s.Username, s.Host) lo.Printf("loaded SMTP: %s (%s@%s)", s.Name, s.Username, s.Host)
} }
if len(srv) == 0 {
lo.Fatalf("no SMTP servers found in config")
}
// Initialize the default e-mail messenger. // Initialize the default e-mail messenger.
msgr, err := messenger.NewEmailer(srv...) msgr, err := messenger.NewEmailer(srv...)