Dear all,

I am writing a simple mail client in console application form.  I manually 
created a TSmtpCli object for my purpose.

The problem is that after I call the SmtpClient->Connect() method, the client 
fails to connect to the SMTP server.  I referenced the MailSnd example and did 
set SmtpClient->Host, SmtpClient->Port properties as in MailSnd.  Using MailSnd 
to connect and send mail to server does not have problem.

I notice that the events SmtpClientDisplay and SmtpClientRequestDone in MailSnd 
will be triggered when response is received from SMTP server.  I place similar 
event handlers in my program in an attempt to print message on the console 
window, but the events just will not be triggered.  I assign the event handlers 
in the following way:

    SmtpClient = new TSmtpCli(NULL);

    if(SmtpClient != NULL)
      SmtpClient->OnDisplay     = SmtpClientDisplay;
      SmtpClient->OnRequestDone = SmtpClientRequestDone;

Is it the proper way to assign event handler?  How can I trace where the 
problem is in failing to connect to SMTP server?

Many thanks,
Patrick Wong
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to