mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-12 07:17:12 +00:00
feat(accounts): Can now add smtp server to auxilliary accounts
This commit is contained in:
1 parent
59bd290d62
commit
f0010afef4
13 files changed
+293
-48
No files matched your search
@@ -2278,7 +2278,7 @@ static NSString *userAgent = nil;
|
|||||||
NSData *message, *messageForSent;
|
NSData *message, *messageForSent;
|
||||||
SOGoMailFolder *sentFolder;
|
SOGoMailFolder *sentFolder;
|
||||||
SOGoDomainDefaults *dd;
|
SOGoDomainDefaults *dd;
|
||||||
NSURL *sourceIMAP4URL;
|
NSURL *sourceIMAP4URL, *smtpUrl;
|
||||||
NSException *error;
|
NSException *error;
|
||||||
|
|
||||||
dd = [[context activeUser] domainDefaults];
|
dd = [[context activeUser] domainDefaults];
|
||||||
@@ -2307,13 +2307,28 @@ static NSString *userAgent = nil;
|
|||||||
return [NSException exceptionWithHTTPStatus: 500
|
return [NSException exceptionWithHTTPStatus: 500
|
||||||
reason: @"could not generate message content"];
|
reason: @"could not generate message content"];
|
||||||
|
|
||||||
error = [[SOGoMailer mailerWithDomainDefaults: dd]
|
smtpUrl = [self smtp4URL];
|
||||||
sendMailData: message
|
|
||||||
toRecipients: [NSArray arrayWithObject: recipient]
|
if (smtpUrl)
|
||||||
sender: [self sender]
|
{
|
||||||
withAuthenticator: [self authenticatorInContext: context]
|
error = [[SOGoMailer mailerWithDomainDefaultsAndSmtpUrl: dd smtpUrl: smtpUrl]
|
||||||
inContext: context
|
sendMailData: message
|
||||||
systemMessage: NO];
|
toRecipients: [NSArray arrayWithObject: recipient]
|
||||||
|
sender: [self sender]
|
||||||
|
withAuthenticator: [self authenticatorInContext: context]
|
||||||
|
inContext: context
|
||||||
|
systemMessage: NO];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error = [[SOGoMailer mailerWithDomainDefaults: dd]
|
||||||
|
sendMailData: message
|
||||||
|
toRecipients: [NSArray arrayWithObject: recipient]
|
||||||
|
sender: [self sender]
|
||||||
|
withAuthenticator: [self authenticatorInContext: context]
|
||||||
|
inContext: context
|
||||||
|
systemMessage: NO];
|
||||||
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
[self cleanTmpFiles];
|
[self cleanTmpFiles];
|
||||||
@@ -2335,7 +2350,9 @@ static NSString *userAgent = nil;
|
|||||||
return [NSException exceptionWithHTTPStatus: 500
|
return [NSException exceptionWithHTTPStatus: 500
|
||||||
reason: @"could not generate message content"];
|
reason: @"could not generate message content"];
|
||||||
|
|
||||||
error = [[SOGoMailer mailerWithDomainDefaults: dd]
|
smtpUrl = [self smtp4URL];
|
||||||
|
|
||||||
|
error = [[SOGoMailer mailerWithDomainDefaultsAndSmtpUrl: dd smtpUrl: smtpUrl]
|
||||||
sendMailData: message
|
sendMailData: message
|
||||||
toRecipients: [self allBareRecipients]
|
toRecipients: [self allBareRecipients]
|
||||||
sender: [self sender]
|
sender: [self sender]
|
||||||
|
|||||||
@@ -95,7 +95,10 @@ typedef enum {
|
|||||||
- (NSDictionary *) identityForEmail: (NSString *) email;
|
- (NSDictionary *) identityForEmail: (NSString *) email;
|
||||||
- (NSString *) signature;
|
- (NSString *) signature;
|
||||||
- (NSString *) encryption;
|
- (NSString *) encryption;
|
||||||
|
- (NSString *) smtpEncryption;
|
||||||
- (NSString *) tlsVerifyMode;
|
- (NSString *) tlsVerifyMode;
|
||||||
|
- (NSString *) smtpTlsVerifyMode;
|
||||||
|
- (NSMutableString *) smtp4URLString;
|
||||||
|
|
||||||
/* folder pathes */
|
/* folder pathes */
|
||||||
- (NSArray *) toManyRelationshipKeysWithNamespaces: (BOOL) withNSs;
|
- (NSArray *) toManyRelationshipKeysWithNamespaces: (BOOL) withNSs;
|
||||||
|
|||||||
@@ -800,6 +800,17 @@ static NSString *inboxFolderName = @"INBOX";
|
|||||||
return encryption;
|
return encryption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) smtpEncryption
|
||||||
|
{
|
||||||
|
NSString *encryption;
|
||||||
|
|
||||||
|
encryption = [[self _mailAccount] objectForKey: @"smtpEncryption"];
|
||||||
|
if (![encryption length])
|
||||||
|
encryption = @"none";
|
||||||
|
|
||||||
|
return encryption;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) tlsVerifyMode
|
- (NSString *) tlsVerifyMode
|
||||||
{
|
{
|
||||||
NSString *verifyMode;
|
NSString *verifyMode;
|
||||||
@@ -811,6 +822,17 @@ static NSString *inboxFolderName = @"INBOX";
|
|||||||
return verifyMode;
|
return verifyMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) smtpTlsVerifyMode
|
||||||
|
{
|
||||||
|
NSString *verifyMode;
|
||||||
|
|
||||||
|
verifyMode = [[self _mailAccount] objectForKey: @"smtpTlsVerifyMode"];
|
||||||
|
if (!verifyMode || ![verifyMode length])
|
||||||
|
verifyMode = @"default";
|
||||||
|
|
||||||
|
return verifyMode;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSMutableString *) imap4URLString
|
- (NSMutableString *) imap4URLString
|
||||||
{
|
{
|
||||||
NSMutableString *imap4URLString;
|
NSMutableString *imap4URLString;
|
||||||
@@ -849,6 +871,42 @@ static NSString *inboxFolderName = @"INBOX";
|
|||||||
return imap4URLString;
|
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
|
- (NSMutableString *) traversalFromMailAccount
|
||||||
{
|
{
|
||||||
return [NSMutableString string];
|
return [NSMutableString string];
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
@interface SOGoMailBaseObject : SOGoObject
|
@interface SOGoMailBaseObject : SOGoObject
|
||||||
{
|
{
|
||||||
NSURL *imap4URL;
|
NSURL *imap4URL;
|
||||||
|
NSURL *smtp4URL;
|
||||||
NGImap4Connection *imap4;
|
NGImap4Connection *imap4;
|
||||||
BOOL imap4ExceptionsEnabled;
|
BOOL imap4ExceptionsEnabled;
|
||||||
}
|
}
|
||||||
@@ -74,6 +75,7 @@
|
|||||||
- (NSMutableString *) traversalFromMailAccount;
|
- (NSMutableString *) traversalFromMailAccount;
|
||||||
|
|
||||||
- (NSURL *) imap4URL;
|
- (NSURL *) imap4URL;
|
||||||
|
- (NSURL *) smtp4URL;
|
||||||
- (NSString *) imap4PasswordRenewed: (BOOL) renew;
|
- (NSString *) imap4PasswordRenewed: (BOOL) renew;
|
||||||
|
|
||||||
- (void) flushMailCaches;
|
- (void) flushMailCaches;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[imap4URL release];
|
[imap4URL release];
|
||||||
|
[smtp4URL release];
|
||||||
[imap4 release];
|
[imap4 release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
@@ -317,6 +318,35 @@
|
|||||||
return imap4URL;
|
return imap4URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSURL *) smtp4URL
|
||||||
|
{
|
||||||
|
SOGoMailAccount *account;
|
||||||
|
NSString *urlString, *smtpUrl;
|
||||||
|
NSString *useTls = @"NO";
|
||||||
|
|
||||||
|
/* this could probably be handled better from NSURL but it's buggy in
|
||||||
|
GNUstep */
|
||||||
|
if (!smtp4URL)
|
||||||
|
{
|
||||||
|
account = [self mailAccountFolder];
|
||||||
|
smtpUrl = [account smtp4URLString];
|
||||||
|
if(smtpUrl)
|
||||||
|
{
|
||||||
|
if ([[account smtpEncryption] isEqualToString: @"tls"])
|
||||||
|
{
|
||||||
|
useTls = @"YES";
|
||||||
|
}
|
||||||
|
urlString = [NSString stringWithFormat: @"%@?tls=%@&tlsVerifyMode=%@",
|
||||||
|
smtpUrl, useTls, [account smtpTlsVerifyMode]];
|
||||||
|
smtp4URL = [[NSURL alloc] initWithString: urlString];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
smtp4URL = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
return smtp4URL;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) imap4PasswordRenewed: (BOOL) renewed
|
- (NSString *) imap4PasswordRenewed: (BOOL) renewed
|
||||||
{
|
{
|
||||||
return [[self mailAccountFolder] imap4PasswordRenewed: renewed];
|
return [[self mailAccountFolder] imap4PasswordRenewed: renewed];
|
||||||
|
|||||||
@@ -43,6 +43,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (SOGoMailer *) mailerWithDomainDefaults: (SOGoDomainDefaults *) dd;
|
+ (SOGoMailer *) mailerWithDomainDefaults: (SOGoDomainDefaults *) dd;
|
||||||
|
+ (SOGoMailer *) mailerWithDomainDefaultsAndSmtpUrl: (SOGoDomainDefaults *) dd
|
||||||
|
smtpUrl: (NSURL *) smtpUrl;
|
||||||
|
|
||||||
- (id) initWithDomainDefaults: (SOGoDomainDefaults *) dd;
|
- (id) initWithDomainDefaults: (SOGoDomainDefaults *) dd;
|
||||||
- (BOOL) requiresAuthentication;
|
- (BOOL) requiresAuthentication;
|
||||||
|
|||||||
@@ -148,6 +148,13 @@
|
|||||||
return [[self alloc] initWithDomainDefaults: dd];
|
return [[self alloc] initWithDomainDefaults: dd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (SOGoMailer *) mailerWithDomainDefaultsAndSmtpUrl: (SOGoDomainDefaults *) dd
|
||||||
|
smtpUrl: (NSURL *) smtpUrl
|
||||||
|
{
|
||||||
|
return [[self alloc] initWithDomainDefaultsAndSmtpUrl: dd
|
||||||
|
smtpUrl: smtpUrl];
|
||||||
|
}
|
||||||
|
|
||||||
- (id) initWithDomainDefaults: (SOGoDomainDefaults *) dd
|
- (id) initWithDomainDefaults: (SOGoDomainDefaults *) dd
|
||||||
{
|
{
|
||||||
if ((self = [self init]))
|
if ((self = [self init]))
|
||||||
@@ -157,8 +164,23 @@
|
|||||||
smtpMasterUserEnabled = [dd smtpMasterUserEnabled];
|
smtpMasterUserEnabled = [dd smtpMasterUserEnabled];
|
||||||
ASSIGN (smtpMasterUserUsername, [dd smtpMasterUserUsername]);
|
ASSIGN (smtpMasterUserUsername, [dd smtpMasterUserUsername]);
|
||||||
ASSIGN (smtpMasterUserPassword, [dd smtpMasterUserPassword]);
|
ASSIGN (smtpMasterUserPassword, [dd smtpMasterUserPassword]);
|
||||||
ASSIGN (authenticationType,
|
ASSIGN (authenticationType, [[dd smtpAuthenticationType] lowercaseString]);
|
||||||
[[dd smtpAuthenticationType] lowercaseString]);
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithDomainDefaultsAndSmtpUrl: (SOGoDomainDefaults *) dd
|
||||||
|
smtpUrl: (NSURL *) smtpUrl
|
||||||
|
{
|
||||||
|
if ((self = [self init]))
|
||||||
|
{
|
||||||
|
ASSIGN (mailingMechanism, [dd mailingMechanism]);
|
||||||
|
ASSIGN (smtpServer, [smtpUrl absoluteString]);
|
||||||
|
smtpMasterUserEnabled = [dd smtpMasterUserEnabled];
|
||||||
|
ASSIGN (smtpMasterUserUsername, [dd smtpMasterUserUsername]);
|
||||||
|
ASSIGN (smtpMasterUserPassword, [dd smtpMasterUserPassword]);
|
||||||
|
ASSIGN (authenticationType, [[dd smtpAuthenticationType] lowercaseString]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -242,9 +264,12 @@
|
|||||||
NGSmtpClient *client;
|
NGSmtpClient *client;
|
||||||
NSException *result;
|
NSException *result;
|
||||||
NSURL * smtpUrl;
|
NSURL * smtpUrl;
|
||||||
|
SOGoUser* user;
|
||||||
|
|
||||||
result = nil;
|
result = nil;
|
||||||
|
|
||||||
|
//find the smtpurl for the account
|
||||||
|
|
||||||
smtpUrl = [[[NSURL alloc] initWithString: smtpServer] autorelease];
|
smtpUrl = [[[NSURL alloc] initWithString: smtpServer] autorelease];
|
||||||
|
|
||||||
client = [NGSmtpClient clientWithURL: smtpUrl];
|
client = [NGSmtpClient clientWithURL: smtpUrl];
|
||||||
|
|||||||
+86
-37
@@ -650,16 +650,17 @@ static const NSString *kEncryptedUserNamePrefix = @"uenc";
|
|||||||
|
|
||||||
- (void) _appendSystemMailAccountWithDelegatedIdentities: (BOOL) appendDeletegatedIdentities
|
- (void) _appendSystemMailAccountWithDelegatedIdentities: (BOOL) appendDeletegatedIdentities
|
||||||
{
|
{
|
||||||
NSString *fullName, *imapLogin, *imapServer, *cImapServer,
|
NSString *fullName, *imapLogin, *imapServer, *cImapServer, *smtpServer,
|
||||||
*encryption, *scheme, *action, *queryTls, *customEmail, *sieveServer, *tlsVerifyMode;
|
*imapEncryption, *smtpEncryption, *imapScheme, *smtpScheme, *action, *imapQueryTls, *smtpQueryTls,
|
||||||
|
*customEmail, *sieveServer, *imapTlsVerifyMode, *smtpTlsVerifyMode;
|
||||||
NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts, *security, *mailSettings;
|
NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts, *security, *mailSettings;
|
||||||
NSDictionary *queryComponents;
|
NSDictionary *imapQueryComponents, *smtpQueryComponents;
|
||||||
NSNumber *port;
|
NSNumber *imapPort, *smtpPort;
|
||||||
NSMutableArray *identities, *mails;
|
NSMutableArray *identities, *mails;
|
||||||
NSArray *delegators, *delegates;
|
NSArray *delegators, *delegates;
|
||||||
NSURL *url, *cUrl;
|
NSURL *imapUrl, *cImapUrl, *smtpUrl;
|
||||||
unsigned int count, max; //, default_identity;
|
unsigned int count, max; //, default_identity;
|
||||||
NSInteger defaultPort;
|
NSInteger imapDefaultPort, smtpDefaultPort;
|
||||||
NSUInteger index;
|
NSUInteger index;
|
||||||
BOOL hasDefaultIdentity;
|
BOOL hasDefaultIdentity;
|
||||||
|
|
||||||
@@ -675,7 +676,7 @@ static const NSString *kEncryptedUserNamePrefix = @"uenc";
|
|||||||
inDomain: [self domain]];
|
inDomain: [self domain]];
|
||||||
[mailAccount setObject: imapLogin forKey: @"userName"];
|
[mailAccount setObject: imapLogin forKey: @"userName"];
|
||||||
|
|
||||||
// 2. server
|
// 2.1 IMAP server
|
||||||
// imapServer might have the following format
|
// imapServer might have the following format
|
||||||
// localhost
|
// localhost
|
||||||
// localhost:143
|
// localhost:143
|
||||||
@@ -687,57 +688,105 @@ static const NSString *kEncryptedUserNamePrefix = @"uenc";
|
|||||||
|
|
||||||
cImapServer = [self _fetchFieldForUser: @"c_imaphostname"];
|
cImapServer = [self _fetchFieldForUser: @"c_imaphostname"];
|
||||||
imapServer = [[self domainDefaults] imapServer];
|
imapServer = [[self domainDefaults] imapServer];
|
||||||
cUrl = [NSURL URLWithString: (cImapServer ? cImapServer : @"")];
|
cImapUrl = [NSURL URLWithString: (cImapServer ? cImapServer : @"")];
|
||||||
url = [NSURL URLWithString: imapServer];
|
imapUrl = [NSURL URLWithString: imapServer];
|
||||||
if([cUrl host])
|
if([cImapUrl host])
|
||||||
imapServer = [cUrl host];
|
imapServer = [cImapUrl host];
|
||||||
else
|
else
|
||||||
if(cImapServer)
|
if(cImapServer)
|
||||||
imapServer = cImapServer;
|
imapServer = cImapServer;
|
||||||
else
|
else
|
||||||
if([url host])
|
if([imapUrl host])
|
||||||
imapServer = [url host];
|
imapServer = [imapUrl host];
|
||||||
[mailAccount setObject: imapServer forKey: @"serverName"];
|
[mailAccount setObject: imapServer forKey: @"serverName"];
|
||||||
|
|
||||||
// 3. port & encryption
|
// 2.2 IMAP port & encryption
|
||||||
scheme = [cUrl scheme] ? [cUrl scheme] : [url scheme];
|
imapScheme = [cImapUrl scheme] ? [cImapUrl scheme] : [imapUrl scheme];
|
||||||
queryComponents = [cUrl query] ? [cUrl queryComponents] : [url queryComponents];
|
imapQueryComponents = [cImapUrl query] ? [cImapUrl queryComponents] : [imapUrl queryComponents];
|
||||||
queryTls = [queryComponents valueForKey: @"tls"];
|
imapQueryTls = [imapQueryComponents valueForKey: @"tls"];
|
||||||
tlsVerifyMode = [queryComponents valueForKey: @"tlsVerifyMode"];
|
imapTlsVerifyMode = [imapQueryComponents valueForKey: @"tlsVerifyMode"];
|
||||||
|
|
||||||
if (!tlsVerifyMode)
|
if (!imapTlsVerifyMode)
|
||||||
tlsVerifyMode = @"default";
|
imapTlsVerifyMode = @"default";
|
||||||
|
|
||||||
if (scheme
|
if (imapScheme && [imapScheme caseInsensitiveCompare: @"imaps"] == NSOrderedSame)
|
||||||
&& [scheme caseInsensitiveCompare: @"imaps"] == NSOrderedSame)
|
|
||||||
{
|
{
|
||||||
if (queryTls && [queryTls caseInsensitiveCompare: @"YES"] == NSOrderedSame)
|
if (imapQueryTls && [imapQueryTls caseInsensitiveCompare: @"YES"] == NSOrderedSame)
|
||||||
{
|
{
|
||||||
defaultPort = 143;
|
imapDefaultPort = 143;
|
||||||
encryption = @"tls";
|
imapEncryption = @"tls";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
encryption = @"ssl";
|
imapEncryption = @"ssl";
|
||||||
defaultPort = 993;
|
imapDefaultPort = 993;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (queryTls && [queryTls caseInsensitiveCompare: @"YES"] == NSOrderedSame)
|
if (imapQueryTls && [imapQueryTls caseInsensitiveCompare: @"YES"] == NSOrderedSame)
|
||||||
encryption = @"tls";
|
imapEncryption = @"tls";
|
||||||
else
|
else
|
||||||
encryption = @"none";
|
imapEncryption = @"none";
|
||||||
|
|
||||||
defaultPort = 143;
|
imapDefaultPort = 143;
|
||||||
}
|
}
|
||||||
|
|
||||||
port = [cUrl port] ? [cUrl port] : [url port];
|
imapPort = [cImapUrl port] ? [cImapUrl port] : [imapUrl port];
|
||||||
if ([port intValue] == 0) /* port is nil or intValue == 0 */
|
if ([imapPort intValue] == 0) /* port is nil or intValue == 0 */
|
||||||
port = [NSNumber numberWithInt: defaultPort];
|
imapPort = [NSNumber numberWithInt: imapDefaultPort];
|
||||||
[mailAccount setObject: port forKey: @"port"];
|
[mailAccount setObject: imapPort forKey: @"port"];
|
||||||
[mailAccount setObject: encryption forKey: @"encryption"];
|
[mailAccount setObject: imapEncryption forKey: @"encryption"];
|
||||||
[mailAccount setObject: tlsVerifyMode forKey: @"tlsVerifyMode"];
|
[mailAccount setObject: imapTlsVerifyMode forKey: @"tlsVerifyMode"];
|
||||||
|
|
||||||
|
//3.1 SMTP server
|
||||||
|
smtpServer = [[self domainDefaults] smtpServer];
|
||||||
|
smtpUrl = [NSURL URLWithString: smtpServer];
|
||||||
|
if([smtpUrl host])
|
||||||
|
smtpServer = [smtpUrl host];
|
||||||
|
[mailAccount setObject: smtpServer forKey: @"smtpServerName"];
|
||||||
|
|
||||||
|
// 3.2 SMTP port and encryption
|
||||||
|
smtpScheme = [smtpUrl scheme];
|
||||||
|
smtpQueryComponents = [smtpUrl queryComponents];
|
||||||
|
smtpQueryTls = [smtpQueryComponents valueForKey: @"tls"];
|
||||||
|
smtpTlsVerifyMode = [smtpQueryComponents valueForKey: @"tlsVerifyMode"];
|
||||||
|
|
||||||
|
if (!smtpTlsVerifyMode)
|
||||||
|
smtpTlsVerifyMode = @"default";
|
||||||
|
|
||||||
|
if (smtpScheme && [smtpScheme caseInsensitiveCompare: @"smtps"] == NSOrderedSame)
|
||||||
|
{
|
||||||
|
if (smtpQueryTls && [smtpQueryTls caseInsensitiveCompare: @"YES"] == NSOrderedSame)
|
||||||
|
{
|
||||||
|
smtpDefaultPort = 465; //Shoud be 587 but sope sope-mime/NGMail/NGSmtpClient.m initWithUrl doesn't agree...
|
||||||
|
smtpEncryption = @"tls";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
smtpEncryption = @"ssl";
|
||||||
|
smtpDefaultPort = 465; //Shoud be 587 but sope sope-mime/NGMail/NGSmtpClient.m initWithUrl doesn't agree...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (smtpQueryTls && [smtpQueryTls caseInsensitiveCompare: @"YES"] == NSOrderedSame)
|
||||||
|
{
|
||||||
|
smtpEncryption = @"tls";
|
||||||
|
smtpDefaultPort = 465;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
smtpEncryption = @"none";
|
||||||
|
smtpDefaultPort = 25;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
smtpPort = [smtpUrl port];
|
||||||
|
if ([smtpPort intValue] == 0) /* port is nil or intValue == 0 */
|
||||||
|
smtpPort = [NSNumber numberWithInt: smtpDefaultPort];
|
||||||
|
[mailAccount setObject: smtpPort forKey: @"smtpPort"];
|
||||||
|
[mailAccount setObject: smtpEncryption forKey: @"smtpEncryption"];
|
||||||
|
[mailAccount setObject: smtpTlsVerifyMode forKey: @"smtpTlsVerifyMode"];
|
||||||
|
|
||||||
// 4. Sieve server
|
// 4. Sieve server
|
||||||
sieveServer = [self _fetchFieldForUser: @"c_sievehostname"];
|
sieveServer = [self _fetchFieldForUser: @"c_sievehostname"];
|
||||||
|
|||||||
@@ -231,8 +231,10 @@
|
|||||||
"Mail Account" = "Mail Account";
|
"Mail Account" = "Mail Account";
|
||||||
"New Mail Account" = "New Mail Account";
|
"New Mail Account" = "New Mail Account";
|
||||||
"Server Name" = "Server Name";
|
"Server Name" = "Server Name";
|
||||||
|
"Outgoing Server Name (SMTP)" = "Outgoing Server Name (SMTP)";
|
||||||
"Port" = "Port";
|
"Port" = "Port";
|
||||||
"Encryption" = "Encryption";
|
"Encryption" = "Encryption";
|
||||||
|
"Outgoing Encryption" = "Outgoing Encryption";
|
||||||
"None" = "None";
|
"None" = "None";
|
||||||
"User Name" = "User Name";
|
"User Name" = "User Name";
|
||||||
"Full Name" = "Full Name";
|
"Full Name" = "Full Name";
|
||||||
|
|||||||
@@ -231,8 +231,10 @@
|
|||||||
"Mail Account" = "Compte courriel";
|
"Mail Account" = "Compte courriel";
|
||||||
"New Mail Account" = "Nouveau compte";
|
"New Mail Account" = "Nouveau compte";
|
||||||
"Server Name" = "Serveur";
|
"Server Name" = "Serveur";
|
||||||
|
"Outgoing Server Name (SMTP)" = "Serveur sortant (SMTP)";
|
||||||
"Port" = "Port";
|
"Port" = "Port";
|
||||||
"Encryption" = "Chiffrement";
|
"Encryption" = "Chiffrement";
|
||||||
|
"Outgoing Encryption" = "Chiffrement sortant";
|
||||||
"None" = "Aucun";
|
"None" = "Aucun";
|
||||||
"User Name" = "Utilisateur";
|
"User Name" = "Utilisateur";
|
||||||
"Full Name" = "Nom complet";
|
"Full Name" = "Nom complet";
|
||||||
|
|||||||
@@ -1358,6 +1358,7 @@ static NSArray *reminderValues = nil;
|
|||||||
if (!knownKeys)
|
if (!knownKeys)
|
||||||
{
|
{
|
||||||
knownKeys = [NSArray arrayWithObjects: @"id", @"name", @"serverName", @"port",
|
knownKeys = [NSArray arrayWithObjects: @"id", @"name", @"serverName", @"port",
|
||||||
|
@"smtpServerName", @"smtpPort", @"smtpEncryption",
|
||||||
@"userName", @"password", @"encryption", @"replyTo",
|
@"userName", @"password", @"encryption", @"replyTo",
|
||||||
@"identities", @"mailboxes", @"forceDefaultIdentity",
|
@"identities", @"mailboxes", @"forceDefaultIdentity",
|
||||||
@"receipts", @"security", @"isNew",
|
@"receipts", @"security", @"isNew",
|
||||||
|
|||||||
@@ -77,6 +77,54 @@
|
|||||||
</md-radio-group>
|
</md-radio-group>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
|
|
||||||
|
<div layout="row">
|
||||||
|
<md-input-container class="md-block md-flex">
|
||||||
|
<label><var:string label:value="Outgoing Server Name (SMTP)"/></label>
|
||||||
|
<input name="smtpServerName" type="text"
|
||||||
|
ng-pattern="$AccountDialogController.hostnameRE"
|
||||||
|
ng-disabled="$AccountDialogController.accountId == 0"
|
||||||
|
ng-model="$AccountDialogController.account.smtpServerName"/>
|
||||||
|
<div ng-messages="accountForm.smtpServerName.$error" role="alert">
|
||||||
|
<div ng-message="pattern"><var:string label:value="Specify a hostname other than the local host"/></div>
|
||||||
|
</div>
|
||||||
|
</md-input-container>
|
||||||
|
|
||||||
|
<md-input-container class="md-block" flex="30">
|
||||||
|
<label><var:string label:value="Port"/></label>
|
||||||
|
<input type="number" min="1" max="65535"
|
||||||
|
ng-disabled="$AccountDialogController.accountId == 0"
|
||||||
|
ng-model="$AccountDialogController.account.smtpPort"
|
||||||
|
placeholder=""
|
||||||
|
sg-placeholder="$AccountDialogController.smtpDefaultPort"/>
|
||||||
|
</md-input-container>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<md-input-container class="md-block md-input-has-value">
|
||||||
|
<label><var:string label:value="Outgoing Encryption"/></label>
|
||||||
|
<md-radio-group ng-model="$AccountDialogController.account.smtpEncryption">
|
||||||
|
<div layout="row" layout-align="space-around">
|
||||||
|
<div>
|
||||||
|
<md-radio-button
|
||||||
|
ng-click="$AccountDialogController.smtpDefaultPort = 25"
|
||||||
|
ng-disabled="$AccountDialogController.accountId == 0"
|
||||||
|
value="none" class="md-primary"><var:string label:value="None"/></md-radio-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<md-radio-button
|
||||||
|
ng-click="$AccountDialogController.smtpDefaultPort = 465"
|
||||||
|
ng-disabled="$AccountDialogController.accountId == 0"
|
||||||
|
value="ssl"><var:string label:value="SSL"/></md-radio-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<md-radio-button
|
||||||
|
ng-click="$AccountDialogController.smtpDefaultPort = 465"
|
||||||
|
ng-disabled="$AccountDialogController.accountId == 0"
|
||||||
|
value="tls"><var:string label:value="TLS"/></md-radio-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</md-radio-group>
|
||||||
|
</md-input-container>
|
||||||
|
|
||||||
<div layout="row">
|
<div layout="row">
|
||||||
<md-input-container class="md-block" flex="50">
|
<md-input-container class="md-block" flex="50">
|
||||||
<label><var:string label:value="User Name"/></label>
|
<label><var:string label:value="User Name"/></label>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
var vm = this, usesSSO = $window.usesCASAuthentication || $window.usesSAML2Authentication;
|
var vm = this, usesSSO = $window.usesCASAuthentication || $window.usesSAML2Authentication;
|
||||||
|
|
||||||
this.defaultPort = 143;
|
this.defaultPort = 143;
|
||||||
|
this.smtpDefaultPort = 25;
|
||||||
this.defaults = defaults;
|
this.defaults = defaults;
|
||||||
this.account = account;
|
this.account = account;
|
||||||
this.maxSize = maxSize;
|
this.maxSize = maxSize;
|
||||||
@@ -30,6 +31,11 @@
|
|||||||
else if (this.account.encryption == "ssl")
|
else if (this.account.encryption == "ssl")
|
||||||
this.defaultPort = 993;
|
this.defaultPort = 993;
|
||||||
|
|
||||||
|
if (!this.account.smtpEncryption)
|
||||||
|
this.account.smtpEncryption = "none";
|
||||||
|
else
|
||||||
|
this.smtpDefaultPort = 465;
|
||||||
|
|
||||||
_loadCertificate();
|
_loadCertificate();
|
||||||
|
|
||||||
this.uploader = new FileUploader({
|
this.uploader = new FileUploader({
|
||||||
|
|||||||
Reference in new issue
Block a user