From a8bbaf01d7812cd9097584af4beb8b46d29ea14e Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 30 Jul 2020 15:16:28 -0400 Subject: [PATCH] feat(mail): handle multiple mail identities Fixes #5087 --- SoObjects/Mailer/SOGoDraftObject.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index f89a3532b..109c21507 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -692,7 +692,13 @@ static NSString *userAgent = nil; if (_fromSentMailbox) [self _addRecipients: [_envelope from] toArray: addrs]; else - [self _addRecipients: [_envelope to] toArray: addrs]; + { + [self _addRecipients: [_envelope to] toArray: addrs]; + if ([addrs count] == 0) + [self _addRecipients: [_envelope cc] toArray: addrs]; + if ([addrs count] == 0) + [self _addRecipients: [_envelope bcc] toArray: addrs]; + } if ([addrs count]) { @@ -707,6 +713,12 @@ static NSString *userAgent = nil; [_info setObject: [self _emailFromIdentity: identity] forKey: @"from"]; } } + else + { + identity = [[context activeUser] defaultIdentity]; + if (identity) + [_info setObject: [self _emailFromIdentity: identity] forKey: @"from"]; + } } //