diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 08ef11d39..b0ed7714f 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -522,12 +522,17 @@ static NSString *sieveScriptName = @"sogo"; mailAccount = [self _mailAccount]; encryption = [mailAccount objectForKey: @"encryption"]; defaultPort = 143; - protocol = @"imaps"; + protocol = @"imap"; if ([encryption isEqualToString: @"ssl"]) - defaultPort = 993; - else if (![encryption isEqualToString: @"tls"]) - protocol = @"imap"; + { + protocol = @"imaps"; + defaultPort = 993; + } + else if ([encryption isEqualToString: @"tls"]) + { + protocol = @"imaps"; + } username = [mailAccount objectForKey: @"userName"]; escUsername diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index cc903dd05..451672f30 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -531,14 +531,15 @@ url = [NSURL URLWithString: imapServer]; scheme = [url scheme]; - port = [url port]; + port = ([url port] ? [url port] : @"143"); encryption = @"none"; if ([url query] && [[url query] caseInsensitiveCompare: @"tls=YES"] == NSOrderedSame) encryption = @"tls"; - if ([scheme caseInsensitiveCompare: @"imaps"] == NSOrderedSame && + if (scheme && + [scheme caseInsensitiveCompare: @"imaps"] == NSOrderedSame && ![encryption isEqualToString: @"tls"]) { encryption = @"ssl";