TIdMessagePartType
TIdMessagePartType = (mptText, mptAttachment)
Example
procedure CountPart(Part: TIdMessagePart; var TextCount: Integer);
begin
if Part.PartType = mptText then
TextCount := TextCount + 1;
end;
Usage
TIdMessagePartType classifies a Velox message part as text or attachment from its runtime part class.
Members
| Value | Ordinal | Meaning |
|---|---|---|
mptText | 0 | A TIdText part; included in the message-parts text count. |
mptAttachment | 1 | A base or attachment part; included in the attachment count. |
Behavior and boundaries
- A part with a
text/...MIME Content-Type is not necessarilymptText; runtime class controls this enum result. - A text part can still have a Content-ID and participate in a related MIME layout.
PartTypeand related-part counting are separate. - The base-class default is attachment, so custom subclasses are counted as attachments unless they override
PartType. CountPartsscans the current collection and derives counts; do not treat an earlier result as live after mutation.- Velox POP/IMAP attachment download branches on
mptAttachmentand then uses the default decoder'sTIdAttachmentFile; custom subclasses need their own safe cast/handling. - Automatic download still requires a matching, nonempty filename.
mptAttachmentalone does not guarantee a saved file, whilemptTextparts are not auto-downloaded.
Additional Technical Info
TIdMessagePartType is returned by the virtual class function TIdMessagePart.PartType. It is a runtime-class classification used by TIdMessageParts.CountParts; it is not inferred from Content-Type, a filename or Content-Disposition.
The base TIdMessagePart returns mptAttachment. TIdText overrides it with mptText, and TIdAttachment explicitly returns mptAttachment.
Related Code Library entries
- TIdMessagePart.PartType - exact virtual dispatch and return behavior.
- TIdMessageParts.CountParts - derived text/attachment/related counts.
- TIdMessagePart.ContentType - separate MIME media-type metadata.
External references
- RFC 2045 MIME - MIME content and transfer structure.
- Embarcadero enumerated types - Delphi ordinal semantics.
- Free Pascal ordinal types - compatible enumeration concepts.