AttachFile Method

Attach the specified file to the current message.

Syntax

object.AttachFile( FileName [, Options] )

The AttachFile method syntax has the following parts:

Part Description
object An object expression that evaluates to an InternetMail object.
filename A string which specifies the text to append.
options A long integer which specifies one or more options.

Return Type

Integer

Settings

The settings for Options is:

Value Constant Description
0 mailAttachDefault 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 algorithm. This is the default option for file attachments.
1 mailAttachBase64 The file attachment is always encoded using the standard base64 algorithm, even if the attached file is a plain text file.
2 mailAttachUucode The file attachment is always encoded using the standard uuencode algorithm, even if the attached file is a plain text file.
3 mailAttachQuoted The file attachment is always encoded using quoted-printable encoding. Note that this encoding method is only recommended for text content, typically either as HTML or RTF.

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 FileName argument 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.

The Options argument specifies the type of encoding that will be applied to the attachment. If this argument is not specified, then text files will not be encoded and binary files will be encoded using the standard base64 algorithm.

This method will return value of zero if the action was successful. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

See Also

ContentType Property, AttachData Method, ExtractFile Method


Copyright © 2008 Catalyst Development Corporation. All rights reserved.