GillesL. 0 Posted June 9, 2020 I am having a problem using TSslSmtpCli (v8.55) in a console app (cgi) under windows 10 and Delphi Tokyo (10.2.3). The problem is I can not assign a procedure (created as a TSmtpRequestDone) to the event OnRequestDone since procedures and methods are not compatible. Using a Form provides a mechanism to do so but creates another problem since the app is a console app and I end up with a run time error 216 as the app terminates. Is there any other way other than creating a new component using TCustomSslSmtpCli as a base. Share this post Link to post
Angus Robertson 574 Posted June 9, 2020 Your console application will need events so you can not really take any short cuts. There is a sample Samples\delphi\MailNewsDemos\OverbyteIcsConSmtp.dpr that should help. Angus Share this post Link to post
GillesL. 0 Posted June 10, 2020 I followed the example and used the TSslSmtpCli component instead and it works fine. Thanks for the input. Share this post Link to post
Angus Robertson 574 Posted June 10, 2020 You could also try using TIcsMailQueue which sends mail in the same way as TSslSmtpCli but runs a mail queue with repeated retries to multiple servers on failure. Your application would need to keep running until the queue was empty, and not run multiple copies, but mail is more likely to be delivered. Angus Share this post Link to post
FPiette 383 Posted June 10, 2020 Angus, this model is not suitable for CGI. A CGI module is expected to run as quickly as possible. If a queue and retries have to be done, it must be launched independently by the CGI so that it becomes an independent process. Or the CGI could call a service doing the actual send. Or other similar solutions. Share this post Link to post
Angus Robertson 574 Posted June 10, 2020 Perhaps FastCGI instead, which runs continually. I'm just updating the Jose stuff to handle the server side of Json Web Signing/Tokens for REST servers, currently it only does JWS/JWT for REST clients, and was thinking about how it could be used with web servers other than ICS, FastCGI seems a possibility. TIcsMailQueue can be used separately to queue and send email, the queue format is standard SMTP pick-up as used by Microsoft, although I've not used it like that. Angus Share this post Link to post