On Thu, 14 May 2009 10:31:53 +0000, you wrote:

>> 
>>> Possibly you need breaks? :-)
>>> 
>>> switch(RqType)
>>>  {
>>>   case smtpConnect:  SMTP->Helo(); break;
>>>   case smtpHelo:     SMTP->MailFrom(); break;
>>>   case smtpEhlo:     SMTP->Auth(); break;
>>>   case smtpAuth:     SMTP->MailFrom(); break;
>>>   case smtpMailFrom: SMTP->RcptTo(); break;
>>>   case smtpRcptTo:   SMTP->Data(); break;
>>>   case smtpData:     SMTP->Quit(); break;
>>>  }
>> 
>> No. Tried this too. 
>
>Really?

Yes, really :-)

>
>So please try again, it works fine with the breaks!  
> 

Maybe I did not explain myself thorough enouch, sorry!

The breaks has no effect in this case, as the error comes long before the breaks
will be at any use. Much code hes been made and you have not seen it all :-)

Made another try on another small project with the same result. See here:

First the "MailSendButton":

void __fastcall TForm2::ButtonClick(TObject *Sender)
{
        SMTP->Host           = EditHost->Text;
        SMTP->Port           = EditPort->Text;
        SMTP->SignOn         = EditSignOn->Text;
        SMTP->FromName       = EditFromName->Text;
        SMTP->HdrFrom        = EditFromName->Text;
        SMTP->HdrTo          = EditHdrTo->Text;
        SMTP->HdrCc          = EditHdrCc->Text;
        SMTP->HdrSubject     = EditHdrSubject->Text;
        SMTP->Username       = EditUserName->Text;
        SMTP->Password       = EditPassword->Text;
        SMTP->RcptName->Clear();
        SMTP->RcptNameAdd(EditHdrTo->Text, EditHdrCc->Text, EditHdrBcc->Text);
        Display("Connecting to mailserver");
        SMTP->Connect();
}

And now the OnRequestdone:  (with breaks)  :-)

void __fastcall TForm2::SMTPRequestDone(TObject *Sender, TSmtpRequest RqType,
WORD ErrorCode)

{

> // When arriving to here from "Connect",
> // the RqType is = 0 and the ErrorCode is = 23396  - :-(
> // What is ErrorCode 23396 ?  (Guess it is not known)

 if (ErrorCode > 0 && ErrorCode < 10000) {
  Display("RequestDone Rq=" + IntToStr(RqType) + " Error=" +
SMTP->ErrorMessage);
 } else {
  Display("RequestDone Rq=" + IntToStr(RqType) + " Error=" +
IntToStr(ErrorCode));
 }

 if (ErrorCode == 0) {
  switch(RqType)
   {
        case smtpConnect:       SMTP->Helo();           break;
        case smtpHelo:          SMTP->MailFrom();       break;
        case smtpEhlo:          SMTP->Auth();           break;
        case smtpAuth:          SMTP->MailFrom();       break;
        case smtpMailFrom:      SMTP->RcptTo();         break;
        case smtpRcptTo:        SMTP->Data();           break;
        case smtpData:          SMTP->Quit();           break;
        case smtpQuit:  break;
   }
 }
}

As you see in the comments above, the switch is never reached :-(

The above program is a copy of the MailSnd example, which is in Delphi and works
great here. But in my "translation" to C++ it do not work. I may have missed
something or the SMTP thing don't work at all in C++.

Any suggestions...?

Regards:
Ole Braad-Sorensen
www.importshop.dk
-- 
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

Reply via email to