1
Vote

MailSystem.NET - Attachment without file name in case of .Eml file

description

I am using MailSystem .NET lib. to read emails from one of my email account. Emails contains various attachment files. In normal case, I am able to find all attachment with all details but when any .EML file comes as a attachment then that time FileName display blank or Empty.

I am using below peace of code to get attachment details:
For Each row As Message In objInput
    Dim AttachmentCount As Integer = row.Attachments.Count
            For k As Integer = 0 To AttachmentCount - 1
                Dim attachmentrow As New Attachment
                attachmentrow.FileContent = row.Attachments.Item(k).BinaryContent
                attachmentrow.Filename = row.Attachments.Item(k).Filename
                attachmentrow.MimeType = row.Attachments.Item(k).MimeType
                If Not String.IsNullOrEmpty(row.Attachments.Item(k).Filename) Then
                    attachmentrow.FileExtension = row.Attachments.Item(k).Filename.Substring(Math.Max(0, row.Attachments.Item(k).Filename.Length - 4))
                End If
                attachmentrow.ContentLength = row.Attachments.Item(k).BinaryContent.Length
                Obj.Attachment.Add(attachmentrow)
            Next k
Next
Anyone get this problem so far? Why FileName not found in case of .EML file?

Thanks in advance.

comments