-
-
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
Unable to delete certain e-mails - Index was outside the bounds of the array. #1634
Comments
Thanks for the bug report - the stack trace you provided should be enough for me to fix this, but I'll let you know if I need any more info. |
Yep, easy fix. |
thx for the swift fix, is it possible to get it from somewhere and test it? I pulled down https://www.myget.org/feed/mimekit/package/nuget/MimeKit/4.1.0.916 but same issue persists in that build. BR Andreas |
You can get it from MyGet like you tried to do, but I think the issue is that you grabbed the MimeKit package instead of the MailKit package |
You want to grab the package from here: https://www.myget.org/feed/mimekit/package/nuget/MailKit - v4.1.0.760 |
Describe the bug
When trying to delete certain e-mails (that I suspect is malformed in some way) or possibly that it is a very large inbox with 20k+ emails - it throws this exception for certain e-mails and kills the whole Pop3Client. So even if I try catch and simply ignore and try to proceed, the client is disconnected.
The code is reading e-mails from an account at outlook.office365.com.
Platform (please complete the following information):
Exception
Exception Message: System.IndexOutOfRangeException: 'Index was outside the bounds of the array.'
StackTrace: at MailKit.ByteArrayBuilder.TrimNewLine() at MailKit.Net.Pop3.Pop3Engine.ReadLine(CancellationToken cancellationToken) at MailKit.Net.Pop3.Pop3Engine.ReadResponse(Pop3Command pc, CancellationToken cancellationToken) at MailKit.Net.Pop3.Pop3Engine.Run(Boolean throwOnError, CancellationToken cancellationToken) at MailKit.Net.Pop3.Pop3Client.SendCommand(CancellationToken token, String command) at MailKit.Net.Pop3.Pop3Client.DeleteMessage(Int32 index, CancellationToken cancellationToken)
To Reproduce
Sadly it is very hard to reproduce this issue and I've never seens this type of issue before (and I've been using the mailkit for many years). It seems to be a marketing or spam e-mail of some sort.
Expected behavior
At least if it fails, it would be great if it didn't throw an exception and stopped the flow. I expected e-mail to only be marked for deletion and then committed upon disconnect.
Code Snippets
I simply do a:
using (var mkPop3Client = new MailKit.Net.Pop3.Pop3Client())
{
for (int i = 0; i < mkPop3Client.Count; i++)
{
var message = mkPop3Client.GetMessage(i);
mkPop3Client.DeleteMessage(i);
}
mkPop3Client.Disconnect(true)
}
Protocol Logs
I only get the System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' at MailKit.ByteArrayBuilder.TrimNewLine()
Note: if the protocol log contains sensitive information, feel free to email it to me at
[email protected] instead of including it in the GitHub issue.
The text was updated successfully, but these errors were encountered: