Skip to main content

Specifying the Content and Headers of a Message Part

Specifying the Content and Headers of a Message Part

  1. If the message is not plain text, set the following properties to indicate the kind of message you are creating:

    • If this is an HTML message, set the IsHTML property to 1.

    • If this is a binary message, set the IsBinary property to 1.

  2. To specify the desired character set of the message and its headers, set the Charset property as needed.

    Important:

    It is important to specify the character set before you add the contents of the message.

    For information on character sets and translation tables, see Translation Tables.

  3. Add the contents of the message:

    • For plain text or HTML, use the TextData property, which is an instance of %FileCharacterStreamOpens in a new tab. You do not need to specify the TranslateTable property of this stream; that occurred automatically when you specified the character set of the mail message.

      The system automatically translates the character encoding to the encoding that you specified in the previous step.

    • For binary data, use the BinaryData property, which is an instance of %FileBinaryStreamOpens in a new tab.

    Note that %FileCharacterStreamOpens in a new tab and %FileBinaryStreamOpens in a new tab are deprecated but are still supported for use in this way. It is not recommended to substitute different stream classes for this use case.

    Tip:

    When you specify the Filename property of the stream, be sure to use a directory to which the users will have write access.

    To work with these properties, use the standard stream methods: Write(), WriteLine(), Read(), ReadLine(), Rewind(), MoveToEnd(), and Clear(). You can also use the Size property of the stream, which gives you the size of the message contents.

FeedbackOpens in a new tab