Clarify below question

Here’s the code:


poEmail is MailMessage

foreach (Attachment poAttachment in poEmail.Attachments)
{
try
{
string psContent = poAttachment.???
}
catch (Exception exc)
{
Console.WriteLine(exc.Message);
}

}

How to get the text contents of the attachment?

Hi Jole,

Thank you for writing to Aspose support team.
Following sample code can be used to retrieve the attachment text.

MailMessage msg = MailMessage.Load("Sample.msg");
Attachment att = msg.Attachments[0];

using (var reader = new StreamReader(att.ContentStream, Encoding.UTF8))
{
   var content = reader.ReadToEnd();
   File.WriteAllText("AttachmentText.txt", content);
}