|Subject:||Bug: BCC is send with the headers after LoadFromFile|
|Posted by:||Alex Ivlev (firstname.lastname@example.org)|
|Date:||Fri, 8 Sep 2006|
BCC is the one header that's not supposed to be sent out with the message.
And normally that works fine: procedure TIdMessage.GenerateHeader does not
generate a header line for BCC. Except one case - when the message is saved
to file then BCC is saved with it. But when it's loaded back, procedure
TIdMessage.LoadFromStream forgets to remove that line. So when the message
is sent after that - it's sent by procedure TIdMessageClient.SendMsg with
the BCC header intact, if the NoEncode property is True (if NoEncode = False
then the headers are re-generated without BCC).
Here is a fix for this situation (the 1 added line is marked):
procedure TIdMessage.LoadFromStream(AStream: TIdStream; const AHeadersOnly:
Boolean = False);
// clear message properties, headers before loading
with TIdMessageClient.Create do try
ProcessMessage(Self, AStream, AHeadersOnly);
finally Free; end;
Headers.Values['Bcc'] := ''; // clear saved Bcc!!
Can this be added to the code?