Get HTML from Email Attachment using Pop3Client

117 Views Asked by At

I am using Pop3Client for reading email. The email I'm reading has some files attached. The attached files contain HTML content, so I want to read the file contents as HTML

My code

var Messages = new List<Message>(messageCount); // messageCount = total unread email

for (int i = 0; i < messageCount; i++)
{
    Message getMessage = client.GetMessage(i + 1);
    Messages.Add(getMessage);
}

int k = 1;
foreach (Message msg in Messages)
{
    foreach (var attachment in msg.FindAllAttachments())
    {
        var html = attachment.GetBodyAsText();
    }
}

Output

Output

But I need the output in HTML format; how can I convert the output to HTML?

0

There are 0 best solutions below