Re: Connection closed gracefully

Giganews Newsgroups
Subject: Re: Connection closed gracefully
Posted by:  Remy Lebeau \(Indy Team\) (
Date: Sun, 13 Dec 2009

"Alan T" <alan_NO_SPAM_plt…> wrote in message

> 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:


> 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
reaons 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 (TeamB)



In response to

Connection closed gracefully posted by Alan T on Mon, 14 Dec 2009