[dev] Bad tagged response with empty body part in Horde_Imap_Client
Michael J Rubinsky
mrubinsk at horde.org
Mon Oct 8 19:34:38 UTC 2012
I've been getting a bunch of errors in ActiveSync syncing with one
user account. From what I can tell, it appears to be triggered when an
email contains an empty body part. Here is the IMAP log from a request
that results in the Bad Taagged Response error:
>> Timestamp: Mon, 08 Oct 2012 15:10:52 -0400
S: * OK [CAPABILITY IMAP4rev1 LITERAL+ LOGIN-REFERRALS ID ENABLE
XIMAPPROXY] Dovecot ready.
C: [LOGIN Command - username: ashley]
S: * OK [XPROXYREUSE] IMAP connection reused by imapproxy
S: 1 OK User logged in
C: 2 EXAMINE "INBOX" (QRESYNC (1292555818 45620
539,613,650,762,821:822,838,874,916,1009,1012,1026,1088,1102:1104,1106,1115,1119,1138,1157,1163,1182,1191,1199,1209,1214,1253,1280,1294,1309,1315,1374:1375,1469,1476,1542,1545,1759,1766:1767,1783,1792,1843,1856,1868,1876,1922,1937,1964:1965,1974,1982:1983,1985,2011,2049,2069,2072,2085,2115:2116,2119:2120,2122:2125,2129:2134,2136:2138,2142,2145,2183,2200,2224,2259,2274,2285,2288,2303,2321,2323,2326,2330,2350,2370,2404:2437,2439:2447,2449:2456,2458:2464,11228:11229,11231,11233,11236,11239,11242,11245,11256,11258:11259,11269,11274,11276,11278,11299,11302,11309:11310,11316:11317,11325,11327,11330,11335,11340,11345,11347:11348,11361:11362,11389,11392,11395,11405:11406,11409,11415,11423:11428,11432:11433,11441,11448,11450,11476:11477,11480,11488,11492,11496:11497,11502:11503,11509:11512,11514:11516,11523,11525,11528,11531,11533,11543,11545,11551,11573,11588,11592,11623,11626,11630,11635,11649,11656,11669:11670,11674:11678,11697,11725,11727:11728,11737,11739:11741,11743,11748,11770:
11771,11
778:11779,11787:11788,11794,11796,11798,11803,11809,11837,11869,11880,11884,11895:11896,11909,11922,11936,11940,11945,11948:11977))
S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft $forwarded)
S: * OK [PERMANENTFLAGS ()] Read-only mailbox.
S: * 1695 EXISTS
S: * 0 RECENT
S: * OK [UNSEEN 57] First unseen.
S: * OK [UIDVALIDITY 1292555818] UIDs valid
S: * OK [UIDNEXT 11978] Predicted next UID
S: * OK [HIGHESTMODSEQ 45620] Highest
S: 2 OK [READ-ONLY] Select completed.
>> CACHE: Retrieved messages (mailbox: INBOX; UIDs: 11949)
C: 3 SELECT "INBOX"
S: * OK [CLOSED] Previous mailbox closed.
S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft $forwarded)
S: * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft
$forwarded \*)] Flags permitted.
S: * 1695 EXISTS
S: * 0 RECENT
S: * OK [UNSEEN 57] First unseen.
S: * OK [UIDVALIDITY 1292555818] UIDs valid
S: * OK [UIDNEXT 11978] Predicted next UID
S: * OK [HIGHESTMODSEQ 45620] Highest
S: 3 OK [READ-WRITE] Select completed.
C: 4 UID FETCH 11949 (BODY[HEADER])
S: * 1667 FETCH (UID 11949 BODY[HEADER] {2045}
S: [LITERAL DATA: 2045 bytes]
S: )
S: 4 OK Fetch completed.
>> CACHE: Stored messages (mailbox: INBOX; UIDs: 11949)
>> CACHE: Retrieved messages (mailbox: INBOX; UIDs: 11949)
C: 5 UID FETCH 11949 (BODY.PEEK[1])
S: * 1667 FETCH (UID 11949 BODY[1] {0}
S: )
C: 6 LOGOUT
S: 5 OK Fetch completed.
The email contains a mulitpart/alternative part with the first part
being an empty text/plain part. If needed, I can privately send you
one of the messages.
The following is a simplified version of the code path followed during
the sync process in this case:
$imap = $registry->mail->imapOb();
$mbox = new Horde_Imap_Client_Mailbox('INBOX');
$q = new Horde_Imap_Client_Fetch_Query();
$q->structure();
$q->flags();
$q->headerText();
$ids = new Horde_Imap_Client_Ids(array('11949'));
$mail = $imap->fetch($mbox, $q, array('ids' => $ids));
$msg = current($mail);
foreach ($mail as $data) {
$imap_message = new Horde_ActiveSync_Imap_Message($imap, $mbox, $data);
var_dump($imap_message->getMessageBodyData());
}
--
mike
The Horde Project (www.horde.org)
mrubinsk at horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6062 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.horde.org/archives/dev/attachments/20121008/1c951907/attachment.bin>
More information about the dev
mailing list