Topic Path: Symbol Reference > Classes > TIdMessage Class > TIdMessage Methods > GenerateHeader Method
TIdMessage.GenerateHeader Method

Creates the list of headers for the message.

procedure GenerateHeader;

GenerateHeader is a procedure used to create and populate the MIME-encoded list of message headers in LastGeneratedHeaders

A number of operations are performed in GenerateHeader to prepare for generating headers for the message. 

MessageParts are counted to update the value used when comparing the Encoding and content transfer encodings for the message and message parts. 

If the encoding is meDefault, the user wants to automatically determine the encoding mechanism based on values found in the message and message parts. 

If there are no attachments, the simplest type, just the headers followed by the message body: UU does this for us (note there are no attachments, picking meUU will not generate any UU-encoded message content). 

When are attachments, the default encoding used is MIME-encoding. 

GenerateHeader compares the Encoding for the message to the content tranfer encoding used for any MessageParts. Any unexpected content transfer encoding values are converted to 'base64'. If the message sahould not support attachments in an encoded body, the content transfer encoding for the message is cleared. 

For MIME-encoded messages, the ContentType is determined for any omitted content type, and the MIMEBoundary for the message is generated. 

GenerateHeader uses the message encoders for the message parts to initialize the headers for message. If a message encoder contains a Charset value, it is appended to ContentType

If Encoding contains a value other than meMIME, and the message has multipart/related or multipart/alternative message parts, an EIdMessageException will be raised. 

GenerateHeader calls InitializeISO to determine the encoding used for headers in the message, and adjust the character set based on IdCharactersetNames. 

LastGeneratedHeaders is cleared, and any existing values in Headers is assigned to the LastGeneratedHeaders property. 

The message headers handled in GenerateHeader and added to LastGeneratedHeaders, includes: 




GenerateHeader performs special processing for the values used in some headers in LastGeneratedHeaders


Header Processing 

---------------------------- ----------------------------------------


"In-Reply-To:" Header will contain the value in the Subject property when InReplyTo is an empty string. 
"MIME-Version:" Assigned the value "1.0" only when the encoding is resolved to meMIME. 
"Content-Transfer-Encoding:" Assigned only when the encoding is resolved to meMIME. 
"Date:" Assigned the current date and time when UseNowForDate is True, or the value in the Date property when UseNowForDate is False. 
"X-Priority:" Omitted when the the Priority property contains the value mpNormal. 


GenerateHeader appends any existing values in ExtraHeaders to LastGeneratedHeaders to capture the headers values that may have been created by a UA. Duplicate header names are permitted.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.