feat(mail): add options to not add X-Foward header in mail

This commit is contained in:
Hivert Quentin
2024-03-07 15:36:40 +01:00
parent 815a87de0b
commit 96331cac90
4 changed files with 16 additions and 7 deletions

View File

@@ -530,6 +530,10 @@ This could be `America/New_York`, `Europe/Berlin`, `Asia/Tokyo` or
In our example, we set the time zone to `America/Montreal`.
|D |SOGoMailDisableXForward
|Parameter used to prevent sogo from adding the mail header X-Forward that
contains the user ip. Set to 'YES' to disable this header. Default to 'NO'.
|D |SOGoMailDomain
|Parameter used to set the default domain name used by SOGo. SOGo uses
this parameter to build the list of valid email addresses for users.

View File

@@ -1838,6 +1838,7 @@ static NSString *userAgent = nil;
NSString *s, *dateString;
NGMutableHashMap *map;
id emails, from, replyTo;
BOOL addXForward = NO;
map = [[[NGMutableHashMap alloc] initWithCapacity:16] autorelease];
@@ -1884,16 +1885,14 @@ static NSString *userAgent = nil;
[map addObject: userAgent forKey: @"User-Agent"];
/* add custom headers */
if ([(s = [[context request] headerForKey:@"x-webobjects-remote-host"]) length] > 0 &&
addXForward = ![[[context activeUser] domainDefaults] mailDisableXForward];
if (addXForward && [(s = [[context request] headerForKey:@"x-webobjects-remote-host"]) length] > 0 &&
[s compare: @"localhost"] != NSOrderedSame)
[map addObject: s
forKey: @"X-Forward"];
[map addObject: s forKey: @"X-Forward"];
if ([(s = [headers objectForKey: @"X-Priority"]) length] > 0)
[map setObject: s
forKey: @"X-Priority"];
[map setObject: s forKey: @"X-Priority"];
if ([(s = [headers objectForKey: @"Disposition-Notification-To"]) length] > 0)
[map setObject: s
forKey: @"Disposition-Notification-To"];
[map setObject: s forKey: @"Disposition-Notification-To"];
[self _addHeaders: _headers toHeaderMap: map];

View File

@@ -38,6 +38,7 @@
- (BOOL) mailCustomFromEnabled;
- (BOOL) mailAuxiliaryUserAccountsEnabled;
- (BOOL) mailDisableXForward;
- (NSString *) mailDomain;
- (NSString *) imapServer;
- (NSString *) sieveServer;

View File

@@ -106,6 +106,11 @@
return [self boolForKey: @"SOGoMailAuxiliaryUserAccountsEnabled"];
}
- (BOOL) mailDisableXForward
{
return [self boolForKey: @"SOGoMailDisableXForward"];
}
- (NSString *) mailDomain
{
return [self stringForKey: @"SOGoMailDomain"];