View Issue Details

IDProjectCategoryView StatusLast Update
0003152SOGoActiveSyncpublic2016-04-13 10:07
Reporterzhb Assigned Toludovic  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.2.17 
Fixed in Version2.3.9 
Summary0003152: Sent email breaks mail thread on BlackBerry 10 smartphone
Description

) Add email account as EAS on BlackBerry 10, and as IMAP account on IMAP client (e.g. Mac Mail.app)
) Send one email to itself with Mail.app.
) Reply email on BlackBerry 10
) Reply the email sent with BB10 with Mail.app.
*) View received emails on BB10 Hub, it's not grouped in conversation, but as single email. (Note: BlackBerry Hub is configured to group emails in conversation).

TagsNo tags attached.

Activities

st41ker

st41ker

2015-03-29 04:05

reporter   ~0008368

Last edited: 2015-03-29 04:07

Confirmed.
This happens because BB Mail Client updates the Sent folder via AS just after the mail sending, and get this sent email in text mode without headers(Bugs: 3143,3146,3149). Such as In-Reply-To.

st41ker

st41ker

2015-03-30 05:53

reporter   ~0008372

I've provided temp. workaround in 3146

ludovic

ludovic

2015-03-30 13:53

administrator   ~0008377

https://github.com/inverse-inc/sogo/commit/f5607b3e857270f2efdf7c28a629d93b54029d86

ludovic

ludovic

2015-05-12 14:46

administrator   ~0008471

An additional fix was pushed:

https://github.com/inverse-inc/sogo/commit/e71a1c9974cc6f0177b50065a173aa37963cc159

zhb

zhb

2015-06-30 13:28

reporter   ~0008680

Last edited: 2015-06-30 13:38

Mail thread still broken. Not sure it's a BlackBerry 10 issue or a SOGo issue, hope SOGo developers can help figure it out. Once we confirm it's a BlackBerry issue, i will try to report this in BlackBerry forum.

Steps to reproduce this issue:

1: Send an email with BlackBerry 10 (device: Passport, OS: 10.3.2.2204) to myself. I received this email in seconds, with mail header:

Message-ID: <1st@[my_domain]>

2: Reply to this first received email, received in seconds with below mail headers:

Message-ID: <2nd@[my_domain]>
In-Reply-To: <1st@[my_domain]>

So far so good, emails are grouped in ONE thread.

3: Reply to the latest reply, received in seconds with below mail headers:

Message-ID: <3rd@[my_domain]>
In-Reply-To: <2nd@[my_domain]>

This reply is grouped in a new thread.

The working solution is:

*) New reply email should write ALL message-id exist in head 'Message-ID' and 'In-Reply-To' of original mail to 'In-Reply-To' in new email.

*) New reply email should write ALL message-id exist in head 'Message-ID' and 'References' of original mail to 'References' in new email.

For example:

In-Reply-To: <1st@[my_domain]> <2nd@[my_domain]> <3rd@[my_domain]>
References: <1st@[my_domain]> <2nd@[my_domain]> <3rd@[my_domain]>

This way, all MUAs should correctly detect the thread.

I searched SOGo github repo, i guess we can improve it in file ActiveSync/SOGoActiveSyncDispatcher.m, line 2606:
https://github.com/inverse-inc/sogo/blob/5ad36626406e55e82867351c9775a357748e2b28/ActiveSync/SOGoActiveSyncDispatcher.m#L2606

Write Message-ID and In-Reply-To of old emails to In-Reply-To in new email.
Write Message-ID and References of old emails to References in new email.

Reference: http://cr.yp.to/immhf/thread.html

zhb

zhb

2015-07-14 03:27

reporter   ~0008731

Update: In-Reply-To should contain only the last message id, but References should contains all.

ludovic

ludovic

2015-07-22 14:28

administrator   ~0008748

https://github.com/inverse-inc/sogo/commit/4e7a3ce5fac99efd712168986016295e8e47629a

zhb

zhb

2015-07-23 06:00

reporter   ~0008762

Last edited: 2015-07-23 12:37

If no References: header, SOGo should create it and append value of In-Reply-To: and Message-ID: in References.

st41ker

st41ker

2015-07-27 16:29

reporter   ~0008783

This issue is still reproducible in SoGo 2.3.1.

ludovic

ludovic

2015-09-17 20:30

administrator   ~0008930

Additional fix pushed: https://github.com/inverse-inc/sogo/commit/2bccfcb725e9269e01df11ef3b2c03eba675fc4c

Please try the upcoming nightly builds, available in about 12 hours from now.

zhb

zhb

2015-10-20 15:11

reporter   ~0009015

Last edited: 2015-10-20 15:36

Still not solved with the latest nightly build. I'm now confused which one causes this issue, SOGo, BlackBerry 10, or MUA ... Will try to figure it out.

ludovic

ludovic

2016-01-14 20:42

administrator   ~0009281

Any updates on this?

zhb

zhb

2016-01-16 10:57

reporter   ~0009290

Still not solved with the latest sogo-2.3.5.

st41ker

st41ker

2016-01-22 07:49

reporter   ~0009309

I've an update on the issue.
It seems like latest SoGo (>2.3) almost fixed the issue.
Only third outgoing email in the thread have no earlier Message IDs, so the thread breaks.
Just like SoGo removes them for some reason.

zhb

zhb

2016-03-06 05:48

reporter   ~0009639

Dear support,

Any update on this issue? Current status is just like @st41ker said: "Only third outgoing email in the thread have no earlier Message IDs, so the thread breaks."

tfu

tfu

2016-03-09 21:08

reporter   ~0009664

Can you please reproduce the problem with SOGoEASDebugEnabled = YES and upload the sogo.log. I'm not able to reproduce the problem and what to see the difference compared to my env. The log with the cmd=sendmail requests would help to understand the problem.

zhb

zhb

2016-03-10 01:08

reporter   ~0009674

Last edited: 2016-03-10 01:28

Here's the log of 'Cmd=SendMail' request, let me know if it's not enough:

###############
Mar 10 08:43:19 sogod [1356]: mail.mydomain.com "POST /SOGo/Microsoft-Server-ActiveSync?Cmd=Sync&DeviceType=BlackBerry&User=z
hb%40mydomain.com&DeviceId=BB2AAB1F7E HTTP/1.0" 200 0/77 0.509 - - 0
Mar 10 08:43:20 sogod [1356]: <0x0x556c3f18d458[SOGoActiveSyncDispatcher]> EAS - request for device BB2AAB1F7E: <?xml version
="1.0"?>
<!DOCTYPE ActiveSync PUBLIC "-//MICROSOFT//DTD ActiveSync//EN" "http://www.microsoft.com/&quot;>
<SendMail xmlns="ComposeMail:">
<ClientId>1456153614-1278</ClientId>
<SaveInSentItems/>
<MIME>Q29udGVudC1UeXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9InV0Zi04Ig0KTUlNRS1WZXJzaW9uOiAxLjANCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IH
F1b3RlZC1wcmludGFibGUNClgtQ2xpZW50LUlEOiAxMjc4DQpYLU1haWxlcjogQmxhY2tCZXJyeSBFbWFpbCAoMTAuMy4yLjI4NzYpDQpNZXNzYWdlLUlEOiA8MjA
xNjAzMTAwMDQzMTkuNTM5MDQyMS43MDU1Ny4xMjc4QGlyZWRtYWlsLm9yZz4NCkRhdGU6IFRodSwgMTAgTWFyIDIwMTYgMDg6NDM6MTkgKzA4MDANClN1YmplY3Q6
IFRlc3QgZnJvbSBiYjEwDQpGcm9tOiB6aGJAaXJlZG1haWwub3JnDQpUbzogWmhhbmcgSHVhbmdiaW4gPHpoYkBpcmVkbWFpbC5vcmc+DQoNCjxodG1sPjxoZWFkP
jxtZXRhIGh0dHAtZXF1aXY9M0QiQ29udGVudC1UeXBlIiBjb250ZW50PTNEInRleHQvaHRtbDsgY2hhcnNldD0NCj0zRHV0Zi04Ij48c3R5bGU+IGJvZHkgeyAgZm
9udC1mYW1pbHk6ICJDYWxpYnJpIiwiU2xhdGUgUHJvIixzYW5zLXNlcmlmLCJzYT0NCm5zLXNlcmlmIjsgY29sb3I6IzI2MjYyNiB9PC9zdHlsZT4gPC9oZWFkPiA
8Ym9keSBsYW5nPTNEInpoLUNOIiBzdHlsZT0zRCIiPj0NCjxkaXY+U2VudCBmcm9tIG1vYmlsZTwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+LS0tLTxicj5aaGFu
ZyZuYnNwO0h1YW5nYmluLD0NCiZuYnNwO2ZvdW5kZXImbmJzcDtvZiZuYnNwO2lSZWRNYWlsJm5ic3A7cHJvamVjdDombmJzcDtodHRwOi8vd3d3LmlyZWRtYWlsL
j0NCm9yZy88YnI+VGltZSZuYnNwO3pvbmU6Jm5ic3A7R01UKzgmbmJzcDsoQ2hpbmEvQmVpamluZykuPGJyPkxvb2tpbmcmbmJzcDtmbz0NCnImbmJzcDthbiZuYnNwO29wcG9ydHVuaXR5Jm5ic3A7dG8mbmJzcDttb3ZlJm5ic3A7dG8mbmJzcDthbm90aGVyJm5ic3A7Y291bj0NCnRyeS48L2Rpdj48L2JvZHk+PC9odG1sPg==</MIME>
</SendMail>

Mar 10 08:43:20 sogod [1356]: mail.mydomain.com "POST /SOGo/Microsoft-Server-ActiveSync?Cmd=SendMail&DeviceType=BlackBerry&User=zhb%40mydomain.com&DeviceId=BB2AAB1F7E HTTP/1.0" 200 0/961 0.480 - - 64K
Mar 10 08:43:22 sogod [1356]: <0x0x556c3f12c488[SOGoActiveSyncDispatcher]> EAS - request for device BB2AAB1F7E: <?xml version="1.0"?>
<!DOCTYPE ActiveSync PUBLIC "-//MICROSOFT//DTD ActiveSync//EN" "http://www.microsoft.com/&quot;>
<Sync xmlns="AirSync:">
<Collections>
<Collection>
<SyncKey>1457477752</SyncKey>
<CollectionId>vevent%2FB87704E5-3FA2-4644-A386-1358E45F39DA</CollectionId>
<GetChanges/>
<WindowSize>25</WindowSize>
<Options>
<Class>Calendar</Class>
<FilterType>6</FilterType>
<BodyPreference xmlns="AirSyncBase:">
<Type>1</Type>
<TruncationSize>1048576</TruncationSize>
</BodyPreference>
</Options>
</Collection>
</Collections>
</Sync>
###################

I docoded the content inside <MIME></MIME> block, here's the mail header part:

###################
Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-Client-ID: 1278
X-Mailer: BlackBerry Email (10.3.2.2876)
Message-ID: <20160310004319.5390421.70557.1278@mydomain.com>
Date: Thu, 10 Mar 2016 08:43:19 +0800
Subject: Test from bb10
From: zhb@mydomain.com
To: Zhang Huangbin <zhb@mydomain.com>

###################

zhb

zhb

2016-03-10 01:36

reporter   ~0009675

Did some more testing with a Gmail account, i think the problem is email sent with mobile device + SOGo doesn't have 'References:' header. Below are headers of sent and received emails in order:

1: Gmail -> Me
2: BB10 -> Gmail (WARNING: No 'In-Reply-To:' and 'References:')
3: Gmail -> Me (Note: this is 3rd email in the mail conversation, and thread broke on BB10 with this email. Also, email sent by Gmail contains 'In-Reply-To:' and 'References:')
4: Me (Mac OS X, Mail.app) -> Gmail (Note: mail composed by Mail.app also contains 'In-Reply-To:' and 'References:')
5: Gmail -> Me (has 'In-Reply-To:' and 'References:')

MIME-Version: 1.0
Received: by 10.107.157.68 with HTTP; Wed, 9 Mar 2016 17:21:18 -0800 (PST)
Date: Thu, 10 Mar 2016 09:21:18 +0800
Delivered-To: user@gmail.com
Message-ID: <CAJzwPOOf=tbQyBtYuy8MQtgeAmxBZF8Lx4+6Q_D9huQQ31gPGg@mail.gmail.com>
Subject: test
From: Zhang Huangbin <user@gmail.com>
To: Zhang Huangbin <zhb@mydomain.com>
Content-Type: text/plain; charset=UTF-8

Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-Client-ID: 1304
X-Mailer: BlackBerry Email (10.3.2.2876)
Message-ID: <20160310012216.5374035.64004.1304@mydomain.com>
Date: Thu, 10 Mar 2016 09:22:16 +0800
Subject: Re: test
From: zhb@mydomain.com
To: Zhang Huangbin <user@gmail.com>

MIME-Version: 1.0
Received: by 10.107.157.68 with HTTP; Wed, 9 Mar 2016 17:22:41 -0800 (PST)
In-Reply-To: <20160310012216.5374035.64004.1304@mydomain.com>
References: <20160310012216.5374035.64004.1304@mydomain.com>
Date: Thu, 10 Mar 2016 09:22:41 +0800
Delivered-To: user@gmail.com
Message-ID: <CAJzwPONLqCNx32fs3_eDwBjqtk0mePa-cxvXzeQ2=-ATczkPKg@mail.gmail.com>
Subject: Re: test
From: Zhang Huangbin <user@gmail.com>
To: Zhang Huangbin <zhb@mydomain.com>
Content-Type: text/plain; charset=UTF-8

Delivered-To: user@gmail.com
Received: by 10.107.29.207 with SMTP id d198csp183748iod;
Wed, 9 Mar 2016 17:26:21 -0800 (PST)
X-Received: by 10.182.33.166 with SMTP id s6mr469730obi.30.1457573181534;
Wed, 09 Mar 2016 17:26:21 -0800 (PST)
Return-Path: <zhb@mydomain.com>
Received: from mail.mydomain.com (mail.mydomain.com. [45.56.127.226])
by mx.google.com with ESMTPS id oi2si718451obc.104.2016.03.09.17.26.21
for <user@gmail.com>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 09 Mar 2016 17:26:21 -0800 (PST)
Received-SPF: pass (google.com: domain of zhb@mydomain.com designates 45.56.127.226 as permitted sender) client-ip=45.56.127.226;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of zhb@mydomain.com designates 45.56.127.226 as permitted sender) smtp.mailfrom=zhb@mydomain.com;
dkim=pass header.i=@mydomain.com
Received: from mail.mydomain.com (mail.mydomain.com [127.0.0.1])
by mail.mydomain.com (Postfix) with ESMTP id 377F34212
for <user@gmail.com>; Thu, 10 Mar 2016 01:26:21 +0000 (UTC)
Authentication-Results: mail.mydomain.com (amavisd-new);
dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
header.d=mydomain.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mydomain.com; h=
x-mailer:to:references:message-id:content-transfer-encoding:date
:date:in-reply-to:from:from:subject:subject:mime-version
:content-type:content-type; s=dkim; t=1457573180; x=1458437181;
bh=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN/XKdLCPjaYaY=; b=rkk2BDBdMNFd
btGVpajZcnYpXSBZCshNfWa7JKEXCVBJDxKxGH8vRDz19W5rH0Egn6vajO28TTk7
KcuNxhHQmz8325K/Q94fDmK5ugI6h6vBXFwvN8rzwD4r6iQb7zpv9U48hyXFMZ02
oXQJDX1VoZ4Z53yuDQBAq1LAa4gPuDI=
X-Virus-Scanned: amavisd-new at mail.mydomain.com
X-Spam-Flag: NO
X-Spam-Score: -1
X-Spam-Level:
X-Spam-Status: No, score=-1 tagged_above=-100 required=6.2
tests=[ALL_TRUSTED=-1] autolearn=ham
Received: from mail.mydomain.com ([127.0.0.1])
by mail.mydomain.com (mail.mydomain.com [127.0.0.1]) (amavisd-new, port 10026)
with ESMTP id TCgEXrsa5S1c for <user@gmail.com>;
Thu, 10 Mar 2016 01:26:20 +0000 (UTC)
Received: from [192.168.1.2] (unknown [110.88.122.62])
by mail.mydomain.com (Postfix) with ESMTPSA id 0729341C5
for <user@gmail.com>; Thu, 10 Mar 2016 01:26:19 +0000 (UTC)
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 9.2 (3112))
Subject: Re: test
From: Zhang Huangbin <zhb@mydomain.com>
In-Reply-To: <CAJzwPONLqCNx32fs3_eDwBjqtk0mePa-cxvXzeQ2=-ATczkPKg@mail.gmail.com>
Date: Thu, 10 Mar 2016 09:26:09 +0800
Content-Transfer-Encoding: 7bit
Message-Id: <3A6C156F-ED37-4CE3-A2DB-5CBF839C4E1E@mydomain.com>
References: <20160310012216.5374035.64004.1304@mydomain.com> <CAJzwPONLqCNx32fs3_eDwBjqtk0mePa-cxvXzeQ2=-ATczkPKg@mail.gmail.com>
To: Zhang Huangbin <user@gmail.com>
X-Mailer: Apple Mail (2.3112)

MIME-Version: 1.0
Received: by 10.107.157.68 with HTTP; Wed, 9 Mar 2016 17:26:46 -0800 (PST)
In-Reply-To: <3A6C156F-ED37-4CE3-A2DB-5CBF839C4E1E@mydomain.com>
References: <20160310012216.5374035.64004.1304@mydomain.com>
<CAJzwPONLqCNx32fs3_eDwBjqtk0mePa-cxvXzeQ2=-ATczkPKg@mail.gmail.com>
<3A6C156F-ED37-4CE3-A2DB-5CBF839C4E1E@mydomain.com>
Date: Thu, 10 Mar 2016 09:26:46 +0800
Delivered-To: user@gmail.com
Message-ID: <CAJzwPOPWF6sy1xLc6S8bh4ru4f32WE8EJvomi0g6QKivkRg31A@mail.gmail.com>
Subject: Re: test
From: Zhang Huangbin <user@gmail.com>
To: Zhang Huangbin <zhb@mydomain.com>
Content-Type: text/plain; charset=UTF-8

zhb

zhb

2016-03-10 01:45

reporter   ~0009676

Is it a BB10 issue/bug, or a SOGo issue?

zhb

zhb

2016-03-10 02:02

reporter   ~0009677

Email sent from SOGo web UI contains 'In-Reply-To:', but no 'References:'.

tfu

tfu

2016-03-10 06:46

reporter   ~0009679

When you reply from bb10 to gmail do you see a Cmd=SmartReply in sogo.log?
If a email is set via Cmd=SendMail sogo can only use the headers which are included in the email. With Cmd=SmartReply we pull the in-reply-to and references from the original mail.

st41ker

st41ker

2016-03-10 08:14

reporter   ~0009680

Last edited: 2016-03-10 08:26

I think that I've found the root cause of the issue.
References: mail header modified by SoGo, so some of the mail ids are splitted by new line character.

Example:

References: <m-id1@dom.tld><m-id2@dom.tld><m-id3@dom.tld>
<m-id4@dom.tld>

Should be:

References: <m-id1@dom.tld><m-id2@dom.tld><m-id3@dom.tld><m-id4@dom.tld>

I've tested everything by the following way:

send emails and replies until mail thread breaks on my BB. Then, I've just modified mail files directly on the server, so all References: headers became oneliners. And my BB started to show threads correctly.

Seems like BB IMAP\POP3 client behaves differently, only BB ActiveSync client have such problem with multiline References: header.

zhb

zhb

2016-03-10 09:16

reporter   ~0009681

When you reply from bb10 to gmail do you see a Cmd=SmartReply in sogo.log?

I got "Cmd=SmartReply". So looks like SOGo diesn't add/update "References:" header.

st41ker

st41ker

2016-03-10 09:35

reporter   ~0009682

Last edited: 2016-03-10 10:15

Also, when I've checked EAS debug with working headers and without I found the following:

Multiple lines(breaking thread):

ConversationId of each mail contains BASE64 text of exact References list.

Single lines(working thread):
And it has some empty EAS command.

ConversationId of each email contains BASE64 text of only the first emails mail-id.

Example debug:

Working:

<To xmlns="Email:">"Alexander Magliovany" <secondemail@youritcrowd.com></To>
<From xmlns="Email:">"Alexander Kalashnikov" <firstemail@yandex.ru></From>
<Subject xmlns="Email:">Re: 1111</Subject>
<ThreadTopic xmlns="Email:">1111</ThreadTopic>
<DateReceived xmlns="Email:">2016-03-10T08:48:04.000Z</DateReceived>
<ConversationId xmlns="Email2:">PDIwMTYwMzEwMDg0MzE0LjUxMjQxNzYuOTg0NTEuODM3QHlhbmRleC5ydT4=</ConversationId>

<To xmlns="Email:">"Alexander Kalashnikov" <firstemail@yandex.ru></To>
<From xmlns="Email:">"Alexander Magliovany" <secondemail@youritcrowd.com></From>
<Subject xmlns="Email:">Re: 1111</Subject>
<ThreadTopic xmlns="Email:">1111</ThreadTopic>
<DateReceived xmlns="Email:">2016-03-10T08:45:41.000Z</DateReceived>
<ConversationId xmlns="Email2:">PDIwMTYwMzEwMDg0MzE0LjUxMjQxNzYuOTg0NTEuODM3QHlhbmRleC5ydT4=</ConversationId>

<To xmlns="Email:">"Alexander Magliovany" <secondemail@youritcrowd.com></To>
<From xmlns="Email:">"Alexander Kalashnikov" <firstemail@yandex.ru></From>
<Subject xmlns="Email:">Re: 1111</Subject>
<ThreadTopic xmlns="Email:">1111</ThreadTopic>
<DateReceived xmlns="Email:">2016-03-10T08:48:04.000Z</DateReceived>
<DisplayTo xmlns="Email:">alex.m</DisplayTo>
<Importance xmlns="Email:">1</Importance>
<Read xmlns="Email:">1</Read>
<MessageClass xmlns="Email:">IPM.Note</MessageClass>
<ContentClass xmlns="Email:">urn:content-classes:message</ContentClass>
<InternetCPID xmlns="Email:">65001</InternetCPID>
<Body xmlns="AirSyncBase:">
<Type>2</Type>
<Truncated>0</Truncated>
<Preview/>
<Data/>
<EstimatedDataSize>0</EstimatedDataSize>
</Body>
<Flag xmlns="Email:">
<FlagStatus>0</FlagStatus>
</Flag>
<Categories xmlns="Email:"/>
<ConversationId xmlns="Email2:">PDIwMTYwMzEwMDg0MzE0LjUxMjQxNzYuOTg0NTEuODM3QHlhbmRleC5ydT4=</ConversationId>
<NativeBodyType xmlns="AirSyncBase:">2</NativeBodyType>

<To xmlns="Email:">"Alexander Magliovany" <secondemail@youritcrowd.com></To>
<From xmlns="Email:">"Alexander Kalashnikov" <firstemail@yandex.ru></From>
<Subject xmlns="Email:">1111</Subject>
<ThreadTopic xmlns="Email:">1111</ThreadTopic>
<DateReceived xmlns="Email:">2016-03-10T08:43:14.000Z</DateReceived>
<ConversationId xmlns="Email2:">PDIwMTYwMzEwMDg0MzE0LjUxMjQxNzYuOTg0NTEuODM3QHlhbmRleC5ydT4=</ConversationId>

Not Working:

<To xmlns="Email:">"Alexander Magliovany" <secondemail@youritcrowd.com></To>
<From xmlns="Email:">"Alexander Kalashnikov" <firstemail@yandex.ru></From>
<Subject xmlns="Email:">Re: 1111</Subject>
<ThreadTopic xmlns="Email:">1111</ThreadTopic>
<DateReceived xmlns="Email:">2016-03-10T08:48:04.000Z</DateReceived>
<ConversationId xmlns="Email2:">PDIwMTYwMzEwMDg0MzE0LjUxMjQxNzYuOTg0NTEuODM3QHlhbmRleC5ydT48MjAxNjAzMTAwODQ1NDEuNTEyNDE3Ni4xOTk
1OC4xNTUxQHlvdXJpdGNyb3dkLmNvbT4=</ConversationId>

<To xmlns="Email:">"Alexander Kalashnikov" <firstemail@yandex.ru></To>
<From xmlns="Email:">"Alexander Magliovany" <secondemail@youritcrowd.com></From>
<Subject xmlns="Email:">Re: 1111</Subject>
<ThreadTopic xmlns="Email:">1111</ThreadTopic>
<DateReceived xmlns="Email:">2016-03-10T08:45:41.000Z</DateReceived>
<ConversationId xmlns="Email2:">PDIwMTYwMzEwMDg0MzE0LjUxMjQxNzYuOTg0NTEuODM3QHlhbmRleC5ydT4=</ConversationId>

<To xmlns="Email:">"Alexander Magliovany" <secondemail@youritcrowd.com></To>
<From xmlns="Email:">"Alexander Kalashnikov" <firstemail@yandex.ru></From>
<Subject xmlns="Email:">1111</Subject>
<ThreadTopic xmlns="Email:">1111</ThreadTopic>
<DateReceived xmlns="Email:">2016-03-10T08:43:14.000Z</DateReceived>
<ConversationId xmlns="Email2:">PDIwMTYwMzEwMDg0MzE0LjUxMjQxNzYuOTg0NTEuODM3QHlhbmRleC5ydT4=</ConversationId>

--
Should not this ConversationId be the same for a thread?

st41ker

st41ker

2016-03-10 10:23

reporter   ~0009686

I've found exact place where the problem is.

Accorting to https://tools.ietf.org/html/rfc822#section-3.2 field-body can be "folded" as it stated in https://www.w3.org/Protocols/rfc822/3_Lexical.html
So, the code in ActiveSync/SOGoMailObject+ActiveSync.m too simple, because it will generate different ConversationID for "folded" References headers:

if ([reference length] > 0)
[s appendFormat: @"<ConversationId xmlns=\"Email2:\">%@</ConversationId>", [[reference dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];
else if ([[self inReplyTo] length] > 0)
[s appendFormat: @"<ConversationId xmlns=\"Email2:\">%@</ConversationId>", [[[self inReplyTo] dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];
else if ([[self messageId] length] > 0)
[s appendFormat: @"<ConversationId xmlns=\"Email2:\">%@</ConversationId>", [[[self messageId] dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];

tfu

tfu

2016-03-10 10:37

reporter   ~0009687

I think the problem is caused by sope. While unfolding header fields sope consumes the cr and whitespace instead of only the whitespace.

st41ker

st41ker

2016-03-10 10:52

reporter   ~0009688

So, how to fix this?

tfu

tfu

2016-03-10 11:00

reporter   ~0009689

I sent a patch for review to Ludovic.

st41ker

st41ker

2016-03-10 11:07

reporter   ~0009690

Thank you.

Also, please, consider the following situation:

references: <5693EB11.2020703@youritcrowd.com><EEA40A16E7B7C240B0769E7126EA9DF013A93E7B@XMB102FCNC.rim.net>

When references includes m-ids without spaces.

tfu

tfu

2016-03-10 11:51

reporter   ~0009693

Yes, this is exactly the problem I described above.

st41ker

st41ker

2016-03-10 11:58

reporter   ~0009694

If I've understood you correctly, then the following headers in the mail will be parsed correctly after the patch?

references: <5693EB11.2020703@youritcrowd.com><EEA40A16E7B7C240B0769E7126EA9DF013A93E7B@XMB102FCNC.rim.net>

references: <5693EB11.2020703@youritcrowd.com> <EEA40A16E7B7C240B0769E7126EA9DF013A93E7B@XMB102FCNC.rim.net>

references: <5693EB11.2020703@youritcrowd.com>
EEA40A16E7B7C240B0769E7126EA9DF013A93E7B@XMB102FCNC.rim.net>

zhb

zhb

2016-03-10 12:43

reporter   ~0009695

I'm not sure i understand @st41ker's comment. but "References:" should be allowed to contain multiple message-ids separated by space. Even the RFC document shows the example with multiple message-id this way (search the last "References:" in below rfc document):
http://www.ietf.org/rfc/rfc2822.txt

References: <1234@local.machine.example> <3456@example.net>

If you check other MUAs, some of they generate "References:" this way too, and it works fine. e.g. Mac Mail.app. And Gmail has one message-id per line.

st41ker

st41ker

2016-03-10 12:50

reporter   ~0009696

@zhb.

RFC2822
3.6.4. Identification fields
The "References:" and "In-Reply-To:" field each contain one or more
unique message identifiers, optionally separated by CFWS.

st41ker

st41ker

2016-03-12 07:16

reporter   ~0009719

@tfu
Could you, please, provide me the patch also, so I could test it?

zhb

zhb

2016-03-16 07:20

reporter   ~0009753

Dear developers,

Any update on this issue?

Related Changesets

sogo: v2 bed5175a

2016-03-16 08:55

ludovic


Details Diff
(fix) properly split long headers (fixes 0003152) Affected Issues
0003152
mod - ActiveSync/SOGoActiveSyncDispatcher.m Diff File
mod - ActiveSync/SOGoMailObject+ActiveSync.m Diff File

sogo: master cd6c5695

2016-03-16 08:55

ludovic


Details Diff
(fix) properly split long headers (fixes 0003152)

Conflicts:

ActiveSync/SOGoMailObject+ActiveSync.m
Affected Issues
0003152
mod - ActiveSync/SOGoActiveSyncDispatcher.m Diff File
mod - ActiveSync/SOGoMailObject+ActiveSync.m Diff File

Issue History

Date Modified Username Field Change
2015-03-28 13:25 zhb New Issue
2015-03-29 04:05 st41ker Note Added: 0008368
2015-03-29 04:07 st41ker Note Edited: 0008368
2015-03-30 05:53 st41ker Note Added: 0008372
2015-03-30 13:53 ludovic Note Added: 0008377
2015-03-30 13:53 ludovic Status new => resolved
2015-03-30 13:53 ludovic Fixed in Version => 2.3.0
2015-03-30 13:53 ludovic Resolution open => fixed
2015-03-30 13:53 ludovic Assigned To => ludovic
2015-05-12 14:46 ludovic Note Added: 0008471
2015-06-30 13:28 zhb Note Added: 0008680
2015-06-30 13:28 zhb Status resolved => feedback
2015-06-30 13:28 zhb Resolution fixed => reopened
2015-06-30 13:30 zhb Note Edited: 0008680
2015-06-30 13:35 zhb Note Edited: 0008680
2015-06-30 13:38 zhb Note Edited: 0008680
2015-07-14 03:27 zhb Note Added: 0008731
2015-07-14 03:27 zhb Status feedback => assigned
2015-07-22 14:28 ludovic Note Added: 0008748
2015-07-22 14:28 ludovic Status assigned => resolved
2015-07-22 14:28 ludovic Fixed in Version 2.3.0 => 2.3.1
2015-07-22 14:28 ludovic Resolution reopened => fixed
2015-07-23 06:00 zhb Note Added: 0008762
2015-07-23 06:00 zhb Status resolved => feedback
2015-07-23 06:00 zhb Resolution fixed => reopened
2015-07-23 12:37 zhb Note Edited: 0008762
2015-07-27 16:29 st41ker Note Added: 0008783
2015-09-17 20:30 ludovic Note Added: 0008930
2015-09-17 20:30 ludovic Status feedback => resolved
2015-09-17 20:30 ludovic Fixed in Version 2.3.1 => 2.3.3
2015-09-17 20:30 ludovic Resolution reopened => fixed
2015-10-20 15:11 zhb Note Added: 0009015
2015-10-20 15:11 zhb Status resolved => feedback
2015-10-20 15:11 zhb Resolution fixed => reopened
2015-10-20 15:17 zhb Note Edited: 0009015
2015-10-20 15:36 zhb Note Edited: 0009015
2016-01-14 20:42 ludovic Note Added: 0009281
2016-01-16 10:57 zhb Note Added: 0009290
2016-01-16 10:57 zhb Status feedback => assigned
2016-01-22 07:49 st41ker Note Added: 0009309
2016-03-06 05:48 zhb Note Added: 0009639
2016-03-09 21:08 tfu Note Added: 0009664
2016-03-10 01:08 zhb Note Added: 0009674
2016-03-10 01:12 zhb Note Edited: 0009674
2016-03-10 01:28 zhb Note Edited: 0009674
2016-03-10 01:36 zhb Note Added: 0009675
2016-03-10 01:45 zhb Note Added: 0009676
2016-03-10 02:02 zhb Note Added: 0009677
2016-03-10 06:46 tfu Note Added: 0009679
2016-03-10 08:14 st41ker Note Added: 0009680
2016-03-10 08:14 st41ker Note Edited: 0009680
2016-03-10 08:26 st41ker Note Edited: 0009680
2016-03-10 09:16 zhb Note Added: 0009681
2016-03-10 09:35 st41ker Note Added: 0009682
2016-03-10 09:40 st41ker Note View State: 0009682: private
2016-03-10 09:43 st41ker Note View State: 0009682: public
2016-03-10 10:15 st41ker Note Edited: 0009682
2016-03-10 10:23 st41ker Note Added: 0009686
2016-03-10 10:37 tfu Note Added: 0009687
2016-03-10 10:52 st41ker Note Added: 0009688
2016-03-10 11:00 tfu Note Added: 0009689
2016-03-10 11:07 st41ker Note Added: 0009690
2016-03-10 11:51 tfu Note Added: 0009693
2016-03-10 11:58 st41ker Note Added: 0009694
2016-03-10 12:43 zhb Note Added: 0009695
2016-03-10 12:50 st41ker Note Added: 0009696
2016-03-12 07:16 st41ker Note Added: 0009719
2016-03-16 07:20 zhb Note Added: 0009753
2016-03-16 12:56 ludovic Changeset attached => sogo v2 bed5175a
2016-03-16 12:56 ludovic Status assigned => resolved
2016-03-16 12:56 ludovic Fixed in Version 2.3.3 => 2.3.9
2016-03-16 12:56 ludovic Resolution reopened => fixed
2016-03-16 12:58 ludovic Changeset attached => sogo master cd6c5695