AttachmentSavedAs Property
Gets the full path to the attachment which was saved to disk.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public string SavedAs { get; }

Property Value

Type: String
A string containing the full path to the attachment which was saved to disk, or empty string if the attachment was not saved to disk yet.

This property is especially useful when the attachment was saved to disk implicitly (for instance, when all embedded pictures/files referenced in the HTML body were saved to disk by GetHtmlAndSaveRelatedFiles method call, and the developer wants to know the exact paths to the saved files).

Filenames of such files depend on the way they were saved. Usually attachments are saved under the path specified by the developer if saving was explicit (e.g. with Save(String, Boolean) method); or if saving was implicit (e.g. with GetHtmlAndSaveRelatedFiles method), attachments are saved to MailMessage.Parser.WorkingFolder.

This sample loads the message from .EML file, saves every attachment to disk specifying only the folder, and displays the full path to each saved file.
// 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();

// For every attachment...
foreach (Attachment attach in msg.Attachments)             
    // the attachment into the specified folder overwriting the existing file if necessary,
    attach.SaveToFolder(@"C:\Temp\", true);

    // and show the full path to the saved file.
    Console.WriteLine("The path is " + attach.SavedAs);
See Also