Hi,
I wrote a mini form-app that connects to an SMTP server and sends an email - using this for batch job control. I want to go away from the form and make it a console application. My problem is that I cannot assign the event handlers for connect, failure, and success like I can do in the form version (type is TNMSMTP) - here's a small test:
The error message is
. What is the best way to make my procedure a method - should I wrap the functions into a 'dummy' object?
Also, since I have to wait for the final event success ot failure before closing the application, what is the best way of doing that? I have to put some code after the
, or the application will stop before it sent the mail, right?
Thanks,
Matthias
I wrote a mini form-app that connects to an SMTP server and sends an email - using this for batch job control. I want to go away from the form and make it a console application. My problem is that I cannot assign the event handlers for connect, failure, and success like I can do in the form version (type is TNMSMTP) - here's a small test:
Code:
program Project1;
{$APPTYPE CONSOLE}
uses SysUtils,NMSMTP;
var
SMTP: TNMSMTP;
procedure SMTPConnect(Sender: TObject);
begin
SMTP.SendMail;
end;
begin
//-- set event handler
SMTP.OnConnect := SMTPConnect;
SMTP.Connect;
end.
The error message is
Code:
"Incompatible types: method pointer and regular procedure"
Also, since I have to wait for the final event success ot failure before closing the application, what is the best way of doing that? I have to put some code after the
Code:
SMTP.Connect
Thanks,
Matthias