trouble with TIdSMTPServer and BCC

Giganews Newsgroups
Subject: trouble with TIdSMTPServer and BCC
Posted by:  Alessandro (petrelliRIMUO…@interfree.it)
Date: Wed, 5 Oct 2005

Hi all,

basically I need to receive an email, add a BCC address and forward it.

Everything works correctly, except the fact that original BCC addresses get
lost.

I'm using latest snapshot of Indy 10, sample code:

procedure TEmailProxyService.SMTPServerMsgReceive(ASender:
TIdSMTPServerContext;
  AMsg: TStream; var LAction: TIdDataReply);
var
  Msg: TIdMessage;
  SMTPClient: TIdSMTP;
  i: integer;
begin
  Msg := TIdMessage.Create(Owner);
  try
    try
      AMsg.Position := 0;

      Msg.LoadFromStream(AMsg);
      Log(Msg.BccList.EMailAddresses);    <--- BCCList is empty

      if Assigned(BccList) then
        for i := 0 to Pred(BccListCount) do
          Msg.BccList.Add.Address := BccList[i];

      Log(Msg.BccList.EMailAddresses);  <---- BCCList contains newly added
addresses
...
...

Thanks for your help.

Best,
Alessandro.

Replies