Thanks for your advice.

Console program does not have message pump by default.  I built a simple 
function to peek messages in the following way:

void __fastcall PumpMessages()
{ 
  MSG  Msg;
  unsigned short TimeTick = 0;

  while(TimeTick < 50)
  {
    if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
    { 
      /* Dispatch the message.                     */
      DispatchMessage(&Msg); 
    } /* End of PeekMessage while loop. */
    else 
    { 
      /* if there is no message to process,        */
      /* then sleep for a while to avoid tight       */
      /* looping                                              */
      Sleep(100);
      /* Increment time tick to allow quiting      */
      /* the loop anyway upon times out           */
      TimeTick++;
    }
  }
}

Not a good design but anyway the events can be triggered now when I call the 
function.

Problem now is when I call SmtpCli->Data(), after the From, To, Subject, 
Content-type stuff are posted the function relies on the SmtpClientGetData 
event handler to post mail body line by line.  In my case since the message 
loop function can only be called after the SmtpCli->Data() returned, therefore 
the MsgLine points to null when being referenced inside SmtpCli->Data().  Is 
there any other way to set the mail body prior to calling Data()?

I also note in the SmtpProt.pas there is a derived class TSyncSmtpCli.  Does 
this class support blocked operations which are not message-based?  Is there 
any example in using this derivative?

Thanks and regards,
Patrick
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to