AttachFile Method  
 

Attach the specified file to the current message.

Syntax

object.AttachFile( FileName, [Options] )

Parameters

FileName
A string which specifies the name of the file to be attached to the message. If the file is empty or does not exist, an error will be returned by the control.
Options
An optional integer value which specifies how the file will be attached to the message. If this argument is omitted and the file is a text file, it will not be encoded; if the file is a binary file, it will be base64 encoded. To override the default encoding used, specify one of the following options:
Value Constant Description
0 mimeAttachDefault The file attachment encoding is based on the file content type. Text files are not encoded, and binary files are encoded using the standard base64 encoding algorithm. This is the default option for file attachments.
1 mimeAttachBase64 The file attachment is always encoded using the standard base64 algorithm, even if the attached file is a plain text file.
2 mimeAttachUucode The file attachment is always encoded using the uuencode algorithm, even if the attached file is a plain text file.

Return Value

A value of zero is returned if the method succeeds. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The AttachFile method attaches the specified file to the current message. If the message already contains one or more file attachments, then it is added to the end of the message. If the message does not contain any attached files, then it is converted to a multipart message and the file is appended to the message.

The AttachImage method can be used to attach an inline image to the message.

See Also

Boundary Property, ContentType Property, AttachImage Method, ExtractFile Method