Internet Direct (Indy)
Home
PreviousUpNext
TIdMessageDecoderMIME.ReadBody Method

Decodes the contents of a MIME-encode message part.

Pascal
function ReadBody(
    ADestStream: TIdStream; 
    var VMsgEnd: Boolean
): TIdMessageDecoder; override;
Parameters 
Description 
ADestStream 
Stream to receive the decode message part contents.
 
VMsgEnd 
Indicates the message terminator was found in the message body. 

TIdMessageDecoder - Decoder used for the message part, or Nil.

ReadBody is a TIdMessageDecoder function used to convert the MIME-encoded contents of an RFC message part to its textual representation. 

When BodyEncoded contains True, the ContentTransferEncoding from the TIdMessage instance that owns the decoder is used to create a decoder class instance for the message part. Otherwise, the 'Content-Transfer-Encoding' value in Headers is used to initialize the decoder class instance . 

ReadBody returns the TIdMessageDecoder instance to be used for the message part, or Nil when the message part is not an encoded attachment. When an attachment is detected, the content-transfer-encoding header is used to determine the proper decoder. 

The following decoders are used based on the content transfer encoding values: 

 

Content Transfer 
Decoder Class 
base64 
quoted-printable 
7bit 
No decoder is required 

 

ReadBody reads the message part content, one line at a time, using the ReadLnSplit method. If a MIMEBoundary is detected in the line, a new TIdMessageDecoderMIME instance is created for the new message part, and the method is exited. If a message terminator (CRLF + '.' + CRLF) is encountered, VMsgEnd is set to True and the method is exited. 

ReadBody uses the message decoder, when present, to convert the encoded data for the message part. Decoded message part contents are written to ADestStream until a blank line (or message terminator) is read from the encoded message part.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.