Attachment Object (Dundas Mailer Control 1.0)
This object is used to store details about a file attachment to be sent with the email. Not used by the QuickSend method.
Remarks
This object comprises the Attachments collection. To add Attachment objects to the Attachment collection use the collection's Add method. To remove a single attachment call the Remove method of the collection. To clear all Attachment objects from the collection use the Clear method.
The Attachment object consists of the following six (6) properties:
FileName as string. The full pathname of the file to be attached to the message.
ContentName as string. Name to be displayed in the client email software. Defaults to the specified FileName argument.
ContentType as string. Specifies the content type of the attachment. Defaults to "Application/Octet-stream".
EncodingType as string. The type of MIME encoding used. This defaults to "BASE64".
CharSet as string. Specifies the character set to be used for the attachment. Defaults to "US-ASCII".
- CustomHeaders as string. Used to add custom headers to the file attachment. Defaults to a zero-length string.
If you do not specify a value for the ContentName property then the client email software will reference the attachment by using the FileName parameter.
The Content-Type header field (represented by the ContentType property) is used to specify the nature of the data in the attachment. It uses type and subtype identifiers in the format of "type/sub-type" (e.g. text/html, text/plain, etc.) and also provides auxiliary information that may be required for certain types. After the type and subtype names the remainder of the header field is simply a set of parameters, specified in an attribute/value notation. These parameters differ for different types, and the ordering of the parameters is not important. Among the defined arguments is a "charset" parameter which determines the character set to be used for the attachment. Comments are allowed in accordance with RFC 822, and the rules for structured header fields may be found in RFC 2046.
The CharSet property determines the character set to be used for the attachment.
The two supported encoding types (as specified by the EncodingType argument) are "BASE64" and "QUOTEDPRINTABLE". If you want to explicitly set the EncodingType parameter then keep in mind that it must be uppercase, and the value of this argument is used for the value of the "Content-Transfer-Encoding" header. If an invalid type is specified then "BASE64" is used. For more information about the "Content-Transfer-Encoding" header refer to RFC 2045.
Note that the QuickSend method DOES NOT utilize the Attachments collection.
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.
See Also: Attachments Collection | Add Method | Remove Method | Item Method | Count Property