Subject: | send emails - Invalid FLoating Point |
Posted by: | Nicolas Jardillier (nicolas.jardilli…@keepcore.com) |
Date: | Wed, 28 Nov 2007 |
Hello,
i work with a CGI stand-alone program to send emails using indy10.
Sometines i have this exception, when the program try to send an email:
An exception has occurred : EInvalidOp=Invalid floating point operation
if this exception occurs, it is catched and then i try to disconnect the
smtp, before a free. It appears that the smtp can not disconnect. The only
way is to kill the program execution. I have to mentionned that i work with
postfix.
here the code:
try
FMailMessage := TIdMessage.Create;
FMailMessage.From.Text := aFrom;
FMailMessage.Sender.Text := aFrom;
FMailMessage.Recipients.EMailAddresses := aTo;
FMailMessage.Subject := aSubject;
anEmail.MailMessage.Body.Text := aBodyText
try
FSMTP := TIdSMTP.Create(nil);
FSMTP.Host := aHost;
FSMTP.Port := aPort;
FSMTP.Connect;
FSMTP.Send(FMailMessage);
except
on E:Exception do
begin
if FSMTP.Connected then
FSMTP.Disconnect;
FSMTP.Free;
end;
end;
finally
if Assigned(FSMTP) then
begin
if FSMTP.Connected then
FSMTP.Disconnect;
FSMTP.Free;
end;
end;