|Subject:||Re: TIdMessage.Headers empty|
|Posted by:||Remy Lebeau \(TeamB\) (email@example.com)|
|Date:||Thu, 31 Jul 2008|
"Philip von Melle" <philip.vonmel…@globetrotter.de> wrote in message
> I have created an instance of TIdMessage and set the Subject,
> From and Recipient properties as well as the body. But when
> accessing AMsg.Headers.Text it is empty.
As it should be. Those properties do not use the Headers property for
storage. In fact, the Headers property is only filled in when loading a
message from file/stream, or receiving it over a connection.
> When using AMsg.SaveToFile all headers appear correctly
> (as well as the body).
Saving the message to file/stream invokes the same logic that is used when
transmitting the message over the connection. Any Headers values that may
be present are copied to an internal TIdHeaderList (the LastGeneratedHeaders
property), and then the various TIdMessage properties overwrite those values
as needed. That TIdHeaderList, not the original Headers, is then used when
formatting the message data.
> What do I need to do to get the Headers property filled
You don't. That is not how TIdMessage works.
TIdMessage.Headers empty posted by Philip von Melle on Thu, 31 Jul 2008