Check IMAP/SMTP servers on startup

Closes: https://todo.sr.ht/~sircmpwn/koushin/46
This commit is contained in:
Simon Ser 2020-01-20 18:46:50 +01:00
parent 3bf17752ab
commit 3340fcd63d
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -127,6 +127,12 @@ func (s *Server) parseIMAPUpstream() error {
panic("unreachable")
}
c, err := s.dialIMAP()
if err != nil {
return fmt.Errorf("failed to connect to IMAP server: %v", err)
}
c.Close()
s.e.Logger.Printf("Configured upstream IMAP server: %v", u)
return nil
}
@ -159,6 +165,12 @@ func (s *Server) parseSMTPUpstream() error {
panic("unreachable")
}
c, err := s.dialSMTP()
if err != nil {
return fmt.Errorf("failed to connect to SMTP server: %v", err)
}
c.Close()
s.e.Logger.Printf("Configured upstream SMTP server: %v", u)
return nil
}