Already connected

Giganews Newsgroups
Subject: Already connected
Posted by:  sunrizer (sunriz…@ukr.net)
Date: Wed, 13 Feb 2008

When I try to connect to the SMTP-server - it raises exception EidAlreadyConnected, previously I disconnect. There is a sample code:

  if (Smtp.Connected) then begin
    try
      Smtp.Disconnect(False);
    except on E: EIdException do
      tmp:=E.Message;
    end;
  end;

try
  Smtp.Connect;
except on E: EIdException do begin
  if (SmtpSender.Connected) then begin
  try
      SmtpSender.Disconnect(False);
    except on E: EIdException do
      tmp:=E.Message;
    end;
  end;
  end;
  end;
Please, HELP! What I'm doing wrong ?

Replies