Skip to main content

TIdMIMEBoundary

TIdMIMEBoundary = class(TObject)

Example

procedure ReadCurrentBoundary(const Message: TIdMessage;
var Value: Variant);
begin
if Message.MIMEBoundary.Count > 0 then
Value := Message.MIMEBoundary.Boundary
else
Value := '';
end;

Usage

TIdMIMEBoundary represents the mutable last-in-first-out boundary stack used by a message while traversing nested MIME multipart content.

Additional Technical Info

TIdMIMEBoundary is Velox's script-visible view of the mutable stack used by TIdMessage while processing nested MIME multipart boundaries. Push adds a boundary at the top, Pop removes the top, Clear empties the stack, Count reports its depth, and Boundary reads the current top string.

Internally, boundary strings and their native parent-part indexes are held in two separate TStringList instances, both with top at index zero. The parent-part property exists in native code but is not registered for scripts. Consequently, scripts can manipulate the pair through Push, but can read only the boundary side.

TIdMessage.MIMEBoundary returns its message-owned instance. Treat that value as borrowed: do not free it, and assume the reference becomes invalid with the message. Mutating it changes parser/encoder working state; application scripts should normally inspect it only when a documented flow specifically exposes a meaningful parsing context.

The implementation permits empty boundary strings and arbitrary integer parent indexes. Because empty-stack Boundary and an empty top boundary both return '', use Count to distinguish them.

The two-list implementation has no locking or transactional rollback. Allocation failure partway through Push or Clear can theoretically desynchronize the parallel lists. Normal message parsing keeps them paired, but callers should avoid concurrent or speculative mutation. Push/pop at index zero are O(depth) because list entries shift.

The source-reviewed example uses the message-owned object and checks Count before interpreting Boundary; it was not runtime-tested.

External references

Created 2026-07-15