AttachmentCollectionAddAsync Method (String, String, String, String, HeaderCollection, NewAttachmentOptions, MailTransferEncoding)

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public Task<bool> AddAsync(
	string filename,
	string targetFilename,
	string contentID,
	string contentType,
	HeaderCollection customHeaders,
	NewAttachmentOptions options,
	MailTransferEncoding mailEnc
)

Parameters

filename
Type: SystemString
The absolute or relative path to the file which should be attached.
targetFilename
Type: SystemString
The filename of the attachment as it should appear in the mail message. If a null reference (Nothing in Visual Basic), MailBee will take it from filename parameter value. If an empty string, the attachment will have no name.
contentID
Type: SystemString
The content identifier (CID) of the attachment (for inline attachments), or empty string if the attachment is not inline.
contentType
Type: SystemString
The content type of the attachment, or a null reference (Nothing in Visual Basic) to let MailBee detect the content type automatically.
customHeaders
Type: MailBee.MimeHeaderCollection
The collection of the headers which should be included into the header section in additon to the standard attachment headers. If a null reference (Nothing in Visual Basic), no custom headers will be added.
options
Type: MailBee.MimeNewAttachmentOptions
The options which affect how the attachment is added.
mailEnc
Type: MailBee.MimeMailTransferEncoding
The mail encoding to use when placing the attachment data into the message.

Return Value

Type: TaskBoolean
A task that represents the asynchronous operation. The value of TResult parameter is true if the attachment was successfully added to the collection; otherwise, false.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionfilename is a null reference (Nothing in Visual Basic) or an empty string.
MailBeeIOExceptionAn error occurred and ThrowExceptions is true.
See Also