diff --git a/NEWS b/NEWS index a82796945..b665efc23 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,7 @@ Bug fixes - [web] fixed renaming a folder under iOS - [web] fixed download of exported folders under iOS - [web] improved server-side CSS sanitizer + - [web] match recipient address when replying (#4495) - [eas] improved alarms syncing with EAS devices (#4351) - [eas] avoid potential cache update when breaking sync queries (#4422) - [eas] fixed EAS search diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 044ff1d13..b212f30e0 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -931,6 +931,7 @@ static NSString *userAgent = nil; { BOOL fromSentMailbox; NSString *msgID; + NSMutableArray *addresses; NSMutableDictionary *info; NGImap4Envelope *sourceEnvelope; @@ -948,6 +949,12 @@ static NSString *userAgent = nil; msgID = [sourceEnvelope messageID]; if ([msgID length] > 0) [self setInReplyTo: msgID]; + + addresses = [NSMutableArray array]; + [self _addEMailsOfAddresses: [sourceEnvelope to] toArray: addresses]; + if ([addresses count]) + [info setObject: [addresses objectAtIndex: 0] forKey: @"from"]; + [self setText: [sourceMail contentForReply]]; [self setHeaders: info]; [self setSourceURL: [sourceMail imap4URLString]]; diff --git a/UI/MailerUI/UIxMailEditor.m b/UI/MailerUI/UIxMailEditor.m index 401205da5..5c3ad2c59 100644 --- a/UI/MailerUI/UIxMailEditor.m +++ b/UI/MailerUI/UIxMailEditor.m @@ -253,11 +253,37 @@ static NSArray *infoKeys = nil; - (NSString *) from { NSArray *identities; + NSEnumerator *allIdentities; + NSDictionary *identity; + NSRange r; + BOOL valid; - if (!from) + identities = [[[self clientObject] mailAccountFolder] identities]; + if ([identities count]) { - identities = [[[self clientObject] mailAccountFolder] identities]; - if ([identities count]) + if (from) + { + allIdentities = [identities objectEnumerator]; + valid = NO; + while ((identity = [allIdentities nextObject]) && !valid) + { + // from ivar must contain a valid email address surrounded by pointy brackets + r = [[from lowercaseString] rangeOfString: [NSString stringWithFormat: @"<%@>", [[identity objectForKey: @"email"] lowercaseString]]]; + if (r.length > 0) + { + valid = YES; + [from release]; + from = [self _emailFromIdentity: identity]; + [from retain]; + } + } + if (!valid) + { + [from release]; + from = nil; + } + } + if (!from) { from = [self _emailFromIdentity: [identities objectAtIndex: 0]]; [from retain];