TnefOptionsMaxPropertyValueLength Property

Get or set the maximum length of a single value that will be read into memory.

Definition

Namespace: MimeKit.Tnef
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public int MaxPropertyValueLength { get; set; }

Property Value

Int32
The maximum value length. The default is DefaultMaxPropertyValueLength.

Remarks

Gets or sets the maximum length, in bytes, of a single attribute or property value that will be read into memory by methods such as ReadValueAsBytes(CancellationToken), ReadValue(CancellationToken) and ReadPropertySet(CancellationToken).

When a value is longer than this limit, a DataSizeLimitExceeded issue is reported and the value is skipped. The methods that return a single value return an empty value instead, and ReadProperty(CancellationToken) returns a TnefProperty without any values.

The limit does not apply to values that are read using OpenValueStream, OpenValueStream or OpenEmbeddedMessage, since those values are not buffered in memory. It does apply to the message bodies and attachment content that are buffered by TnefMessage.

The default limit is suitable for messages that are subject to the 25-35 MB message size limits that are common for SMTP servers. Applications that accept larger messages should increase it.

Exceptions

ArgumentOutOfRangeException value is negative.

See Also