-
-
Notifications
You must be signed in to change notification settings - Fork 818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving the original message stream in case of an exception #198
Comments
I should probably update that text because I think I ended up changing the code to download the message data into a memory stream before parsing it internally to be better able to recover from parsing exceptions :-) Are you working with IMAP or POP3? If you are working with IMAP, you could use the ImapFolder.GetStream() methods to fetch the raw message or mime-part data and then parse that stream after you get it. |
Ah, great! |
Unfortunately, no :-( Perhaps an API can be added... |
I'll dive into your code and add a GetStream() somewhere ;) |
Done. |
And I was looking forward to fork MailKit, write a line of code and do a pull request. Thanks! |
You could still fork it and start looking over the code :-) |
FWIW, relating back to the original question, MimeKit's parser is pretty liberal in what it accepts, so it's rare for it to throw an exception if it looks anything like a message. |
These seem to be the only 2 places where you can get an exception from parsing a message: truncated header block: the first line of the message does not look like a valid header: the other places are for the UNIX mbox parser (i.e. multiple messages back-to-back in the same file) |
Mimekit's liberalness is probably what will win me over. Still I need an escape route for those rare occasions something does go wrong. GetStream() seems to be what I want. |
Hi,
I am evaluating MailKit as the base library for an adapter I'm building. The adapter will be part of a larger application integration framework.
So far Mailkit looks promising.
I have a question though. One of my requirements is the ability to save the original stream (whenever possible and for as much as possible) in case of an exception while parsing it.
The purpose of this would mainly be to record problematic emails either for manual processing (in case of exceptions in production environments we need a way to continue the workflow)
or to slap the developer on the server/other end in the face with.
In https://github.com/jstedfast/MailKit/blob/master/README.md you say:
"It [MailKit] also parses messages directly from the socket instead of downloading the message into a
large string buffer before parsing it (...)"
This leads me to believe it could be difficult to record the complete message stream.
I'd appreciate it if you could give me some advice on how to implement this.
The text was updated successfully, but these errors were encountered: