Re: cancel sending email

Giganews Newsgroups
Subject: Re: cancel sending email
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Tue, 6 Jul 2004

"Malcolm Smith" <mjfreelanci…@optusnet.com.au> wrote in message
news:2E972B2FC8A3E240mjfreelanci…@optusnet.com.au...

> Is there some type of 'abort' method that can be
> called on the TIdSMTP component ?

No.  Well, you could call the VCL's Abort() method inside the OnWork event
(maybe).  The problem is, that still leaves the data connection in an
undeterminable state from that point on since the server is still expecting
the remaining message data to be delivered but you stopped sending it.

The SMTP protocol itself does not have any provisions for cancelling
messages midway through the transmission.

> If not, is it ok to call Disconnect() while an email is being delivered ?

Yes and no.  It is safe to disconnect the socket in general.  The problem
is, TIdSMTP.Disconnect() sends a QUIT command prior to disconnecting the
socket.  If TIdSMTP is still transmitting message data, the server will
never see the QUIT command since it will think it is just more message data.
If the socket is disconnected without the server receiving a valid QUIT
command, any previously accepted messages will be discarded, since SMTP is a
transactional protocol and does not actually deliver accepted messages until
after QUIT is received.

Gambit

Replies

In response to

cancel sending email posted by Malcolm Smith on Tue, 6 Jul 2004