Attachments Collection (Dundas Mailer Control 1.0)

Dundas

Attachments Collection (Dundas Mailer Control 1.0)

The Attachments collection is 0-based and stores Attachment objects. This collection determines how many attachments will be sent with the email if you use the SendMail method.

Remarks

To specify the attachments to be sent with the email add Attachment objects to this collection (unless you are using the QuickSend method to send the mail).

The Attachments collection supports the following methods and properties:

  • Add(FileName as string, [ContentName as string = FileName, ContentType as string = "Application/Octet-stream", EncodingType as string = "BASE64", CharSet as string = "US-ASCII", CustomHeaders as string = ""]). Adds an attachment to the collection.

  • Remove(Index). Removes an attachment from the collection.

  • Count (read-only property). The number of Attachment objects stored in the collection.

  • Item(Index). Used to retrieve an Attachment object from the collection.

  • Clear(). Removes all objects from the collection.

The Index argument can be either a zero-based numerical index or a string key. The string key is defined by the FileName property of the Attachment object.

If you are using the Dundas Upload control you can loop through all items in the the Upload control's Files collection and add each UploadedFile object to the Attachments collection. The uploaded files will then be sent along with the email as attachments. Note that the ContentType of the UploadedFile will be used for the ContentType of the Attachment object, unless you set this argument explicitly. See Tutorial 1: Sending an Email with an Attachment for sample code which demonstrates using the Upload control in conjunction with the Mailer control.

The QuickSend function does not use this collection.

See Also: Attachment Object | Add Method | Remove Method | Clear Method | Item Method | Count Property