Re: IdSMTP - Connection Closed Gracefully

Giganews Newsgroups
Subject: Re: IdSMTP - Connection Closed Gracefully
Posted by:  Remy Lebeau \(Indy Team\) (no.spam@no.spam.com)
Date: Sun, 13 Dec 2009

"Alan T" <alan_NO_SPAM_plt…@yahoo.com.au> wrote in message
news:B21C22DB219CE340alan_NO_SPAM_plt…@yahoo.com.au...

> My client got this error:
> Connection Closed Gracefully.

That means the server is closing the connection on its end.

> These are the code:

You should be calling Connect() outside of the try..finally block, not
inside of it, ie:

StaffIdSMTP.Connect;
try
  ...
finally
  idSMTP.Disconnect;
end;

> If this happened in StaffIdSMTP.Connect;
> we should have socket error, but no socket error.

Then you are actually connecting to a valid server, but there are many
reasons why Send() would fail afterwards.  Maybe you connected to the wrong
type of server (such as by using the wrong port) and it did not understand
the SMTP data being sent to it.  Maybe you connected to a valid SMTP server,
but it was already at its max connections limit and disconnected you
immediately.  Maybe the server accepted your connection, but had an internal
error and had no choice but to disconnect you.

> So the application looked was able to connect but not able to send.

That is exactly what is happening.

--
Remy Lebeau (Indy Team)

Replies

None

In response to

IdSMTP - Connection Closed Gracefully posted by Alan T on Mon, 14 Dec 2009