|Posted by:||Remy Lebeau (Indy Team) (firstname.lastname@example.org)|
|Date:||Mon, 14 Aug 2006|
"Michael Johnson" <architeuthis6…@yahoo.com> wrote in message
> Bill, you have a try...finally with no 'except' clause. You are
> probably failing with an exception
Given Bill's description, that is the only way both halves of the 'if
Connected' block would not be executed.
> since you have no 'except' the finally clause catches the exception
> and supresses it.
The 'finally' block does not suppress exceptions. It ensures that the block
is always run even if an exception is thrown, but the exception continues up
the call stack after the 'finally' block exits.
> I believe you want to do something like this:
Use this instead:
MyMail := TIdSmtp.Create(Self);
with MyMail do
AuthenticationType := atNone;
Host := SMTPAddress;
ShowMessage('Email has been sent.');
on E: Exception do
ShowMessage('Error - ' + E.Message);
Re: IDSmtp posted by Michael Johnson on Mon, 14 Aug 2006