andyedinborough / aenetmail

C# POP/IMAP Mail Client
370 stars 153 forks source link

Truncated attachments? #33

Closed Stonie closed 12 years ago

Stonie commented 12 years ago

I have a very simple bit of code that reads mail from Gmail via the Imap client.

Both text and binary attachments are being truncated, I have tried a ton of different ways of prodding the api, all my attachments come through with correct mime types and file names but are truncated at about ~300 Bytes?

I Stepped ImapClient.GetMessages()

Seems that attachments are truncated coming out of there? so without totally tearing everything down. Does anyone have any ideas? Is there something special I need to do to ensure attachments get fully downloaded?

Regards, Stonie.

piher commented 12 years ago

I am facing the same issue with the new code. All my program does is a loop with a getmessage(i,false) inside. getmessage returns a truncated message.

piher commented 12 years ago

After checking, I think that the getResponse() contains the full contents of the message so it may be some wrong matching that's truncating the email.

[edit] My bad, the response is truncated but instead of the end missing its the headers that have been cut off... [edit2] Ok after a third look, here's the thing : The getResponse returns the end of the message. The returned message only has the beginning of it. When you concat the message returned by getmessage and the response returned by getresponse (on line 369)... you get the full email... There's definitly something wrong in there...

andyedinborough commented 12 years ago

shame face needs better unit testing. I'll be working on this tonight.

Stonie commented 12 years ago

That would be much appreciated. Cheers!

Let me know if you need a hand with anything. ;)

Cheers, Stonie.

andyedinborough commented 12 years ago

I'm really sorry about this guys. I committed a real n00b mistake of not checking the return read count when reading from a stream and just assumed it was returning everything I asked for. Like I said, a real n00b moment for me. :/

I've added a unit test to prevent this from happening again.

Stonie commented 12 years ago

We all need to be humbled by our inner n00b every now and then ;)]

I will pull and rebuild. – Cheers.

piher commented 12 years ago

Thanks for fixing it so quickly, I appreciate it !

Stonie commented 12 years ago

Working great now! Cheers.