Add default ports for IMAP and SMTP
This commit is contained in:
parent
8299617ebc
commit
243e090bcb
1 changed files with 18 additions and 10 deletions
28
server.go
28
server.go
|
@ -114,16 +114,20 @@ func (s *Server) parseIMAPUpstream() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.imap.host = u.Host
|
|
||||||
switch u.Scheme {
|
switch u.Scheme {
|
||||||
case "imap":
|
|
||||||
// This space is intentionally left blank
|
|
||||||
case "imaps":
|
case "imaps":
|
||||||
s.imap.tls = true
|
s.imap.tls = true
|
||||||
case "imap+insecure":
|
case "imap+insecure":
|
||||||
s.imap.insecure = true
|
s.imap.insecure = true
|
||||||
default:
|
}
|
||||||
panic("unreachable")
|
|
||||||
|
s.imap.host = u.Host
|
||||||
|
if !strings.ContainsRune(s.imap.host, ':') {
|
||||||
|
if u.Scheme == "imaps" {
|
||||||
|
s.imap.host += ":993"
|
||||||
|
} else {
|
||||||
|
s.imap.host += ":143"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := s.dialIMAP()
|
c, err := s.dialIMAP()
|
||||||
|
@ -152,16 +156,20 @@ func (s *Server) parseSMTPUpstream() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.smtp.host = u.Host
|
|
||||||
switch u.Scheme {
|
switch u.Scheme {
|
||||||
case "smtp":
|
|
||||||
// This space is intentionally left blank
|
|
||||||
case "smtps":
|
case "smtps":
|
||||||
s.smtp.tls = true
|
s.smtp.tls = true
|
||||||
case "smtp+insecure":
|
case "smtp+insecure":
|
||||||
s.smtp.insecure = true
|
s.smtp.insecure = true
|
||||||
default:
|
}
|
||||||
panic("unreachable")
|
|
||||||
|
s.smtp.host = u.Host
|
||||||
|
if !strings.ContainsRune(s.smtp.host, ':') {
|
||||||
|
if u.Scheme == "smtps" {
|
||||||
|
s.smtp.host += ":465"
|
||||||
|
} else {
|
||||||
|
s.smtp.host += ":587"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := s.dialSMTP()
|
c, err := s.dialSMTP()
|
||||||
|
|
Loading…
Reference in a new issue