TIdMessageEncoding
TIdMessageEncoding = (meDefault, meMIME, mePlainText)
Example
procedure ConfigureMessageLayout(Message: TIdMessage);
begin
Message.Encoding := meMIME;
end;
Usage
TIdMessageEncoding controls whole-message plain-text or MIME layout and Velox's automatic choice for a mail message.
Members
| Value | Ordinal | Meaning |
|---|---|---|
meDefault | 0 | Let header generation choose plain text when there are no parts or MIME when parts exist. |
meMIME | 1 | Generate MIME layout and set the message-parts attachment encoding to MIME. |
mePlainText | 2 | Generate non-MIME/plain layout and set attachment encoding to legacy UUE unless later overridden. |
Behavior and boundaries
- Assigning any value other than
meMIME, includingmeDefault, immediately setsAttachmentEncodingtoUUE; automatic generation can later change the layout. - Encoder lookup can raise after the enum field has been stored, leaving partially updated message state.
ClearHeaderrestores this property tomeDefaultbut does not resetAttachmentEncoding; a reused message can therefore showmeDefaultwhile retaining a previous encoder selection.- When parts exist, unsupported part transfer encodings are normalized: MIME falls back to base64, while plain-text layout falls back to UUE.
- With message parts present, a non-7bit/8bit/binary whole-body transfer encoding is cleared because attachments in an encoded body are unsupported.
- On input, absence of
MIME-VersionselectsmePlainText; its presence selectsmeMIME. The parser does not restoremeDefault. - Use
CharSet,ContentTransferEncodingand partContentTransferfor representation details; do not overload this enum with those decisions.
Additional Technical Info
TIdMessageEncoding selects the message-level layout used by TIdMessage. Despite the name, it is not a character set and is not the per-body or per-part Content-Transfer-Encoding.
meDefault is stateful automatic selection during header generation: no message parts changes the message to mePlainText; any message part changes it to meMIME. The property no longer remains meDefault after that decision.
Related Code Library entries
- TIdMessage.Encoding - exact mutation and generation behavior.
- TIdMessage.ContentTransferEncoding - whole-body transfer encoding.
- TIdMessagePart.ContentTransfer - per-part transfer encoding.
External references
- RFC 2045 MIME format - MIME message and content-transfer framework.
- Embarcadero enumerated types - Delphi ordinal and enumeration semantics.
- Free Pascal ordinal types - compatible enumeration and ordinal concepts.