AttachmentCollectionRemove Method
Removes the attachment having the specified unique name from the collection.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public bool Remove(
	string filename
)

Parameters

filename
Type: SystemString
The unique name of the attachment (as returned by Filename property) to be removed.

Return Value

Type: Boolean
true if the specified attachment was successfully removed; otherwise, false.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionfilename is a null reference (Nothing in Visual Basic).
Remarks
The developer can also use RemoveAt(Int32) method to remove the attachment by its integer zero-based index in the collection.
Examples
This sample loads the message from .EML file and removes the attachment with me.jpg filename.
// 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");

// Remove the specified attachment from the collection.
msg.Attachments.Remove("me.jpg");
See Also