AttachmentCollectionSaveAll Method (String)
Saves all attachments of the message to the specified folder.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public bool SaveAll(
	string folderName
)

Parameters

folderName
Type: SystemString
The absolute or relative path to the folder where to save the attachments.

Return Value

Type: Boolean
true if all attachments were successfully saved; otherwise, false.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionfolderName is a null reference (Nothing in Visual Basic) or an empty string.
MailBeeIOExceptionAn error occurred and ThrowExceptions is true.
Remarks

If the specified folder does not exist, MailBee will try to create it first.

Attachments having duplicate filenames will be renamed and then saved. For instance, if there are three attachments with my_cat.jpg file name, they will be saved to disk under the following filenames:

  • my_cat.jpg
  • my_cat[1].jpg
  • my_cat[2].jpg
For each attachment, SavedAs property can be examined to get the actual file path each file was saved under.

Examples
This sample loads the message from .EML file and saves all attachments into the specified folder.
// 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");

// Save all attachments into the folder.
msg.Attachments.SaveAll(@"C:\Temp");
See Also