feat(accounts): Can now add smtp server to auxilliary accounts

This commit is contained in:
Hivert Quentin
2024-02-01 16:55:41 +01:00
parent 59bd290d62
commit f0010afef4
13 changed files with 293 additions and 48 deletions
+58
View File
@@ -800,6 +800,17 @@ static NSString *inboxFolderName = @"INBOX";
return encryption;
}
- (NSString *) smtpEncryption
{
NSString *encryption;
encryption = [[self _mailAccount] objectForKey: @"smtpEncryption"];
if (![encryption length])
encryption = @"none";
return encryption;
}
- (NSString *) tlsVerifyMode
{
NSString *verifyMode;
@@ -811,6 +822,17 @@ static NSString *inboxFolderName = @"INBOX";
return verifyMode;
}
- (NSString *) smtpTlsVerifyMode
{
NSString *verifyMode;
verifyMode = [[self _mailAccount] objectForKey: @"smtpTlsVerifyMode"];
if (!verifyMode || ![verifyMode length])
verifyMode = @"default";
return verifyMode;
}
- (NSMutableString *) imap4URLString
{
NSMutableString *imap4URLString;
@@ -849,6 +871,42 @@ static NSString *inboxFolderName = @"INBOX";
return imap4URLString;
}
- (NSMutableString *) smtp4URLString
{
NSMutableString *smtp4URLString;
NSDictionary *mailAccount;
NSString *encryption, *protocol, *smtpServerName;
int defaultPort, port;
mailAccount = [self _mailAccount];
smtpServerName = [mailAccount objectForKey: @"smtpServerName"];
if(!smtpServerName)
return nil; //Auxiliary account can be only configured for imap and not smtp
encryption = [mailAccount objectForKey: @"smtpEncryption"];
defaultPort = 25;
protocol = @"smtp";
if ([encryption isEqualToString: @"ssl"])
{
protocol = @"smtps";
defaultPort = 465;
}
else if ([encryption isEqualToString: @"tls"])
{
protocol = @"smtps";
defaultPort = 465;
}
smtp4URLString = [NSMutableString stringWithFormat: @"%@://%@", protocol, smtpServerName];
port = [[mailAccount objectForKey: @"smtpPort"] intValue];
if (port && port != defaultPort)
[smtp4URLString appendFormat: @":%d", port];
[smtp4URLString appendString: @"/"];
return smtp4URLString;
}
- (NSMutableString *) traversalFromMailAccount
{
return [NSMutableString string];