Coder Social home page Coder Social logo

Parsing failure. about mailio HOT 8 CLOSED

EshwaryForReasons avatar EshwaryForReasons commented on May 26, 2024
Parsing failure.

from mailio.

Comments (8)

yjm6560 avatar yjm6560 commented on May 26, 2024 1

I tested this case and share what I found.

gmail imap server changed email state from unread to read when fetching whole RFC822.
in that case, it sends one more untagged response which does not include RFC822.

>>> 3 UID FETCH 62 (UID RFC822)\r\n

<<< * 2 FETCH (UID 62 RFC822 {5140}\r\n
<<< ... # mime data
<<<  FLAGS (\Seen))\r\n
<<< * 2 FETCH (UID 62 FLAGS (\Seen))\r\n # one more untagged response without RFC822 data
<<< 3 OK Success\r\n

mailio::imap::fetch throws Parsing failure imap_error by following line because it didn't get literal response.

throw imap_error("Parsing failure.");

from mailio.

karastojko avatar karastojko commented on May 26, 2024 1

You can try this fix. I have to test it a little bit more.

from mailio.

EshwaryForReasons avatar EshwaryForReasons commented on May 26, 2024

I have made the most peculiar discovery! The parsing error occurs if the message is unread and does not when the message is read! I have no clue why this could be the case, but I am certainly hoping for a fix.

from mailio.

yjm6560 avatar yjm6560 commented on May 26, 2024

the std::cout << message.subject_raw() << std::endl; line in the for loop results in the imap_error exception being thrown. exception.what() returns Parsing failure.

message.subject_raw() throws no exception.
it may be thrown in fetch method

from mailio.

EshwaryForReasons avatar EshwaryForReasons commented on May 26, 2024

My apologies! I double checked and that is indeed the case. However, I still find it a bit absurd that an unread email causes an issue and a read email does not. I am sure there is a perfectly reasonable explanation, but surely other people must have run into this issue? Is there a known fix to this?

Additional information: when retrieving an email with header_only selected, there is no issue. It is only when I want the full email.

from mailio.

karastojko avatar karastojko commented on May 26, 2024

Interesting, let me try to reproduce it.

from mailio.

karastojko avatar karastojko commented on May 26, 2024

Gmail and Outlook send more tokens after the string literal, in this case this is the line FLAGS (\Seen)).
@yjm6560 you are right about the line that throws the exception, thanks for the analysis. If I remove it, then it seems that the message is correctly read even it is unread. As a quick fix, this else statement can be removed, so the unread messages should be correctly read.
I am working on a proper fix to allow parser also to check this additional tokens. I have IMAP auto tests not published here which I'll have also to run in order to check whether something else is broken.
Sorry for taking so long to reply, I am dealing now with this problem.

from mailio.

karastojko avatar karastojko commented on May 26, 2024

The fix does not break existing functionalities, so I am closing it.

from mailio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.