Imports Limilabs.Mail
Imports Limilabs.Mail.MSG

Public Class frmMail
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim oResult = OpenFileDialog1.ShowDialog()

        If oResult = DialogResult.OK Then
            Dim oMail As String = OpenFileDialog1.FileName

            ParseEmail(oMail)
        End If
    End Sub

    Private Sub ParseEmail(Path As String)
        Using oConverter As New MsgConverter(Path)
            If oConverter.Type = MsgType.Note Then
                Dim email As IMail = oConverter.CreateMessage()
                ListBox1.Items.Add("Attachments: " & email.Attachments.Count)

                ListBox1.Items.Add($"To: " & email.To.First()?.GetMailboxes.First.Address)
                ListBox1.Items.Add($"From: " & email.From.First()?.GetMailboxes.First.Address)

                For Each oHeader In email.Headers.AllKeys
                    Dim oHeaderValue = email.Headers.Item(oHeader)


                    ListBox1.Items.Add($"Headers")
                    ListBox1.Items.Add($"Key: {oHeader}, Value: {oHeaderValue}")
                Next
            End If
        End Using
    End Sub
End Class