Skip to main content

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

ValueOrdinalMeaning
mptText0A TIdText part; included in the message-parts text count.
mptAttachment1A base or attachment part; included in the attachment count.

Behavior and boundaries

  • A part with a text/... MIME Content-Type is not necessarily mptText; runtime class controls this enum result.
  • A text part can still have a Content-ID and participate in a related MIME layout. PartType and related-part counting are separate.
  • The base-class default is attachment, so custom subclasses are counted as attachments unless they override PartType.
  • CountParts scans the current collection and derives counts; do not treat an earlier result as live after mutation.
  • Velox POP/IMAP attachment download branches on mptAttachment and then uses the default decoder's TIdAttachmentFile; custom subclasses need their own safe cast/handling.
  • Automatic download still requires a matching, nonempty filename. mptAttachment alone does not guarantee a saved file, while mptText parts 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

External references

Created 2026-07-15