enforceSecureSockets method
void
enforceSecureSockets()
Replaces every preferred server that does not use an SSL/TLS socket from the start by its SSL variant on the standard port (IMAP 993, POP 995, SMTP 465).
Implementation
void enforceSecureSockets() {
ServerConfig? secure(ServerConfig? config) {
if (config == null || config.isSecureSocket) {
return config;
}
final port = switch (config.type) {
ServerType.imap => 993,
ServerType.pop => 995,
ServerType.smtp => 465,
_ => config.port,
};
return config.copyWith(port: port, socketType: SocketType.ssl);
}
preferredIncomingImapServer = secure(preferredIncomingImapServer);
preferredIncomingPopServer = secure(preferredIncomingPopServer);
preferredIncomingServer = secure(preferredIncomingServer);
preferredOutgoingSmtpServer = secure(preferredOutgoingSmtpServer);
preferredOutgoingServer = secure(preferredOutgoingServer);
}