MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.59k stars 623 forks source link

[Bug] - An error was reported when pulling and receiving INBOX -- “Error Domain=MCOErrorDomain Code=3 "Unable to parse response from server." UserInfo={NSLocalizedDescription=Unable to parse response from server.} ” #2005

Open chachayiji opened 1 month ago

chachayiji commented 1 month ago

Summary

Platform(s)

<iOS>

Happens on Mail Server

<163>

Piece of code

MCOIMAPSession *session = [[MCOIMAPSession alloc] init];
[session setHostname:@"imaphz.qiye.163.com"];
[session setPort:993];
[session setUsername:@"xxx@datacloak.com"];
[session setPassword:@"xxxxxxx"];
[session setConnectionType:MCOConnectionTypeTLS];

Actual outcome Parse error,Why can't the data returned by Connection Logs be parsed by mailcore2

Connection Logs

* 235 FETCH (UID 1615978270 INTERNALDATE "29-May-2024 16:42:42 +0800" FLAGS (\Seen) BODYSTRUCTURE (((("text" "plain" ("charset" "UTF-8") NIL NIL "quoted-printable" 3518 67 NIL NIL NIL)("text" "html" ("charset" "UTF-8") NIL NIL "quoted-printable" 3558 69 NIL NIL NIL) "ALTERNATIVE" ("boundary" "----=_Part_6676_826437753.1716972159817") NIL NIL NIL)("image" "jpeg" ("name" "ADVLOGO1644893818405657.jpg") "<logoImageCid02>" NIL "base64" 542670 NIL ("inline" ("filename" "ADVLOGO1644893818405657.jpg")) NIL)("image" "png" ("name" "newLogo.png") "<logoImageCid01>" NIL "base64" 6694 NIL ("inline" ("filename" "newLogo.png")) NIL) "RELATED" ("boundary" "----=_Part_6675_644280001.1716972159817") NIL NIL NIL)("application" "octet-stream" ("name" "=?UTF-8?B?55S15a2Q6KGM56iL5Y2VLnBkZg==?=") NIL """" "base64" 327476 NIL ("attachment" ("filename" "=?UTF-8?B?55S15a2Q6KGM56iL5Y2VLnBkZg==?=")) NIL)("application" "octet-stream" ("name" "=?UTF-8?Q?=E7=94=B5=E5=AD=90=E5=8F=91=E7=A5=A8-1.pdf?=") NIL """" "base64" 49992 NIL ("attachment" ("filename" "=?UTF-8?Q?=E7=94=B5=E5=AD=90=E5=8F=91=E7=A5=A8-1.pdf?=")) NIL) "MIXED" ("boundary" "----=_Part_6674_799664062.1716972159817") NIL NIL NIL) BODY[HEADER.FIELDS (DATE SUBJECT FROM SENDER REPLY-TO TO CC MESSAGE-ID REFERENCES IN-REPLY-TO)] {292}
Date: Wed, 29 May 2024 16:42:39 +0800 (CST)
From: =?UTF-8?B?6aaW5rG957qm6L2m?= <dzfp@dzfp.01zhuanche.com>
To: lc@datacloak.cn
Message-ID: <2078012665.6677.1716972159820@10-71-24-22>
Subject: =?UTF-8?B?6aaW5rG957qm6L2mLeeUteWtkOWPkQ==?=
 =?UTF-8?B?56Wo5Y+K6KGM56iL5Y2V5byA5YW36YCa55+l?=
)

Expected outcome The resolution succeeded and returned to the mailing list

Link to sample code on GitHub reproducing the issue (a full Xcode project):

chachayiji commented 1 month ago

We have discovered that only this specific email cannot be parsed, while other emails are processed normally. Could you please advise on how to configure the system to discard unparseable emails, or alternatively, how to return the unparseable emails to the caller in a different way, while still returning the other successfully parsed emails?