Comments (18)
What are the last few lines of the log? My guess is that the server response is not complete.
from mailkit.
So I just downloaded the source. Here's the call-stack of where it's stuck. It's in the do-while of the Poll method.
[External Code]
MailKit.dll!MailKit.Net.Imap.ImapStream.Poll(System.Net.Sockets.SelectMode mode, System.Threading.CancellationToken cancellationToken) Line 259 + 0x1e bytes C#
MailKit.dll!MailKit.Net.Imap.ImapStream.ReadAhead(byte* inbuf, int atleast, System.Threading.CancellationToken cancellationToken) Line 308 + 0xf bytes C#
MailKit.dll!MailKit.Net.Imap.ImapStream.Read(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) Line 390 + 0x27 bytes C#
MailKit.dll!MailKit.Net.Imap.ImapFolder.FetchMessageBody(MailKit.Net.Imap.ImapEngine engine, MailKit.Net.Imap.ImapCommand ic, int index, MailKit.Net.Imap.ImapToken tok) Line 2717 + 0x65 bytes C#
MailKit.dll!MailKit.Net.Imap.ImapEngine.ProcessUntaggedResponse(System.Threading.CancellationToken cancellationToken) Line 1266 + 0x1c bytes C#
MailKit.dll!MailKit.Net.Imap.ImapCommand.Step() Line 497 + 0x2f bytes C#
MailKit.dll!MailKit.Net.Imap.ImapEngine.Iterate() Line 1340 + 0xf bytes C#
MailKit.dll!MailKit.Net.Imap.ImapEngine.Wait(MailKit.Net.Imap.ImapCommand ic) Line 1368 + 0xa bytes C#
MailKit.dll!MailKit.Net.Imap.ImapFolder.GetMessage(int index, System.Threading.CancellationToken cancellationToken) Line 2878 + 0x1e bytes C#
ClientWish.exe!ClientWish.Robot.Execute() Line 39 + 0x3c bytes C#
ClientWish.exe!ClientWish.Program.Main(string[] args) Line 25 + 0xa bytes C#
[External Code]
from mailkit.
Right, that just means that it expects more data from the server... the question is: why? :-)
from mailkit.
And these are the last lines of the log. They are part of the base64 encoded image.
S: /ErV8M0HO9OzWX9PP07vTf3Te/FxNw1Kv4ceTetNAzJ600/4+6iNPWh+3t9SYUVYABF/oC/duqpG
S: 21vxAXnDksQavLhyXzurMbROrasXbhvREbsDopi4Ag0D2X+D2IWZ2P3rxngRPsz+ksJbKWpdT1/g
S: j6b1oQHpfVn4eu1HGX38ewDJpOy7aPvhToYv9GVrADLJ5HHWfgO2BDpVf7adBAdXaNK2YbxGvWlF
S: 2VxVd150cQpthBN5MM1+fD+vTIR1W3IlZZZ2EQAk7/uaaDqEi2NtzRJ/IviCe4+m92RQ9JH7+D2A
S: rQTcBNwHXMnT217SyIKtS/jxtWwNltGUhAMRa+DuUcD3tdVLpa/qM4ciFkvWjf+R/KXLsm3autXC
S: XonoR9iIIcLSp0RGbvnb5E341hVTRtemtWHbvJ41k2oiP7kiwnUioLqz7/nKMm13tEQIV7llv+La
from mailkit.
If those are the last few lines, then the server response is incomplete.
There should be a response like:
S: A0000016 OK ...
Until that line is received, the server response is incomplete.
from mailkit.
Hmm, I guess you are right. I just copy/pasted the base64 string to a website that can decode base64 and only got halve the expected image as a result.
So I guess the next question is; what is the cause of the incomplete response?
Btw, thanks a lot for your quick responses!
from mailkit.
No prob, you mostly just got lucky that I was just checking for new bug reports minutes after you filed it :p
There are a couple possibilities off the top of my head:
- the server is broken and thinks it sent the complete response
- your network connection dropped
- there's a bug in MailKit somewhere (but I can't even imagine where it could be since ImapStream logs to the log file immediately after reading data from the socket)
Does the log file end in the same place every time you run it? If so, that might indicate 1 (or 3). It could still be 2, but less likely.
If it ends in different places, that could indicate any of the above.
from mailkit.
Yes it keeps loggin the exact same response on every try.
I will go and experiment with the fetch-methods to see if they yield the same results.
Update:
- So far I don't have any problems with the fetch-methods.
- The GetMessage method works on other e-mails.
What would you recommend is the best way to figure out where the problem is?
from mailkit.
Ok, so I guess that means we can rule out flaky network (probably, anyway).
Can you test another client downloading that particular message? Just trying to rule out a bug in MailKit. If other clients break in the same way on that message, then it suggests it's probably a bug in the server.
What server is this, btw?
from mailkit.
This is another IMAP client library you could try: https://imapx.codeplex.com/
from mailkit.
It's an exchange server. I'm not sure about the version, but I guess either 2007 or 2010.
I'm having issues retrieving the folders using ImapX, will let you know when I get further. I'm about to call it a day ;)
Edit: Oops pressed close issue.
from mailkit.
I may have an idea what is causing the problem. Are you using SSL by chance?
It might be that the SslStream has already buffered the remainder of the data and so the Poll() would block forever waiting for data that has already been read from the socket by the SslStream.
from mailkit.
I committed a patch that may fix your issue if this is the case...
from mailkit.
Excellent, it's working now!
i'm not 100% sure if exchange is configured to use SSL, but I'm pretty sure you've guessed right.
Thanks a lot!
Edit: Will you be releasing an update to nuget any time soon? Would rather use nuget than include the source in my project.
from mailkit.
Yea, I'll be releasing a new version soon (by Monday morning the latest - which is my usual release date), but possibly today. I'd like to try to clean up the new logic a bit first.
Thanks for testing it out and getting back to me.
from mailkit.
Just released MailKit 0.21 on nuget
from mailkit.
You're the best!
from mailkit.
I try :-)
from mailkit.
Related Issues (20)
- Done token won't cancel IMap IdleAsync HOT 10
- Syntax error in BODYSTRUCTURE. Unexpected token: '(' HOT 4
- `.Inbox` returning null HOT 10
- Sending MimeMessage using Mircosoft Graph HOT 1
- SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request. HOT 4
- Recommendations for fatching and processing large amounts of emails HOT 1
- [Yandex] GetBodyPart() throws `Syntax error in BODY. Unexpected token: ')'` for MimeParts with empty content HOT 3
- Iterating through attachments does not provide a name for the attachment HOT 2
- Authentication on SMTP to Microsoft Outlook using OAuth HOT 1
- MimeMessage.TextBody not returning body HOT 3
- Code style: use <inheritdoc cref="..."> instead of copying doc HOT 5
- I get a couple of compile errors when updating MailKitLite from 4.3.0 to 4.4.0 HOT 2
- MimeMessage.Subject == null throws off the MailVisitor.
- Regression: Nested signed mail showed as nameless.eml HOT 3
- Question: Logging EHLO Response in DB HOT 2
- XLIST IMAP command being sent automatically on AuthenticateAsync HOT 3
- UTF-8 not supported ?! HOT 1
- client_credentials flow fails for SMTP Office 365 HOT 1
- Special Character on Password HOT 3
- MailKit Login Issue: Stalling on Inbox Access HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailkit.