Back to product page

AttachText Method


Adds new attachment to the message, from the string

Syntax

  • Basic
object.AttachText (Text, Name, ContentType, Encoding)
The AttachText(object,Text,Name,ContentType,Encoding) syntax has these parts:
objectAn expression evaluating to an object of type SmtpMsg
TextRequired. A String value. Text that will be used as attachment.
NameRequired. A String value. Name of file you want to use for your attachment.
ContentTypeRequired. A String value. Specifies Content-Type header value.
EncodingRequired. A Variant value. Specifies preferred encoding type (base64 is default).

Remarks

Unlike Attach method which requires an existing file on your disk, AttachText method will add attachment directly from a string.

If you want to use normal unencrypted data inside AttachText, you need to use encUNKNOWN for Encoding type. Component will encrypt such attachment using Base64 encoding before message is send.

If any other type of encryption is used for Encoding, component will expect that data is already encrypted using encoding type that is selected.

Name of the attachment should be specified as Name argument, while value of content-type header should be specified as ContentType argument.

Platforms

Windows