I’ve been experiencing while receiving emails using MimeMessage from the mail server. Occasionally, when saving attached files, I encounter the error: “Timeout not supported on this stream.” This error does not occur consistently but seems to be triggered by the following function:
private void CreateAttachmentFromImap(MimeEntity attachment, Email email)
{
try
{
#region SaveAttachments
var part = (MimePart)attachment;
var fileName = part.FileName;
var memoryStream = new MemoryStream();
part.Content.DecodeTo(memoryStream);
memoryStream.Position = 0;
_attachmentService.CreateAttachment(email, fileName, memoryStream.ToArray());
#endregion SaveAttachments
}
catch (Exception e)
{
_logger.LogException(e, e.Message, attachment);
}
}
The error seems to be related to stream operations, specifically when dealing with memory streams that do not support timeout settings. I’m looking into potential causes and solutions for this issue, but if you have any insights or suggestions, they would be greatly appreciated.
Thank you for your assistance.