I have a MIME email message that I am parsing using MimeKit. I am able to load in the message and get all the attachment entities like so:
MimeMessage mimeMessage = MimeMessage.Load(decodedDataStream);
int attachmentCount = 0;
foreach (MimeEntity attachment in mimeMessage.Attachments)
{
attachmentCount++;
string fileName = "-a" + attachmentCount;
using (FileStream stream = File.Create(Path.Combine(message.Id + fileName)))
{
if (attachment is MessagePart)
{
var part = (MessagePart)attachment;
part.Message.WriteTo(stream);
}
else
{
var part = (MimePart)attachment;
part.Content.WriteTo(stream);
}
}
}
My question is: Is there any way to get the file offset / position of a particular attachment.
My requirement is to get the location of each attachment in the MIME file. Is there any way I can achieve this? I can see that LumiSoft has a feature to get the PositionSectionStart / PositionBodyStart.
Does MimeKit have any way of doing this, or is there some other way to get the file offset for an attachment?
