Hello,
I have a problem knowing when to delete temp files, the attachments to the
Email message;
Here is my Problem I am having.
=====================================
FIRST TRY
=====================================
(1'st Email)
(Trigger to Send Email)------>Class Fucntion to Send Email.
Event Mail Sent -->Delete Temp
(2'nd Email)
(Trigger to Send Email)------>Class Fucntion to Send Email.
Event Mail Sent -->Delete Temp
My problem is that the File List (TStrings) is LOST or not initialized since
it is not STATIC;
=========================
SECOND ATTEMPT
=========================
I have recently changed the CLASS Structure to not use Class Functions;
But there is a problem: How do I know when to FREEandNil;
freeandNil(Jmail); // MAIL MIGHT NOT BEEN SENT AT THIS STAGE!!!!
//SEND AN EMAIL
JMail := TJEmailer.Create(nil);
JMail.sendEmail(bodytext,'Alarm!',attachList,JpegImagesPath);
freeandNil(Jmail); // MAIL MIGHT NOT BEEN SENT AT THIS STAGE!!!!
procedure TJEmailer.MailServerRequestDone(Sender: TObject;
RqType: TSmtpRequest; ErrorCode: Word);
begin
IF RqType = smtpQuit then
begin
deleteTempImages();
end;
end;
procedure TJEmailer.deleteTempImages();
var
idx : Integer;
begin
for idx := 0 to (imageListD.Count-1) do
DeleteFile(imageListD[idx]);
RemoveDir(JpegImagesPath);
//freeAndNil(imageListD);
end;
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be