AttachmentFilenameOriginal Property |
Namespace: MailBee.Mime
The value of this property is taken from filename parameter of Content-Disposition header.
If Content-Disposition header or filename parameter is missing, FilenameOriginal property will contain an empty string, while Filename property will be set to non-empty value (taken from other headers or autogenerated by MailBee).
The developer can use FilenameOriginal to get the real name of the attached file as it was specified in the e-mail. To get the unique filename of the attachment within the Attachments collection, use Filename property.
For instance, when two files with equal filenames cat.jpg are attached to the message, their original filenames will be cat.jpg for both the files, but their Filename values will be cat.jpg and cat[1].jpg.
Thus, Filename is usually equal to FilenameOriginal of the same attachment, but it may be different sometimes.// To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class) // Load the message from file. MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\TestMail.eml"); // For every attachment... foreach (Attachment attach in msg.Attachments) { // ...show the original filename of the attachment. Console.WriteLine("Filename is " + attach.FilenameOriginal); }