On Fri, 24 Aug 2012 07:04:39 +0200, you wrote: [snip] > Give the SslMailSnd demo a trial, it works: > > < 220 mx.google.com ESMTP fu8sm2298248wib.5 > RequestDone Rq=0 Error=0 > > EHLO your_name > < 250-mx.google.com at your service, [77.184.1.222] > < 250-SIZE 35882577 > < 250-8BITMIME > < 250-STARTTLS > < 250 ENHANCEDSTATUSCODES > RequestDone Rq=10 Error=0 > > STARTTLS > < 220 2.0.0 Ready to start TLS > Starting SSL handshake > Secure connection with TLSv1, cipher ECDHE-RSA-RC4-SHA, 128 secret bits (128 > total) > RequestDone Rq=12 Error=0 > > Demo settings: > smtp.gmail.com:25 > SslVerifyPeer = unchecked > SSL type = Explicit(StartSssl)
Hi Arno, I'm sorry to say, I couldn't run the demo in cbuilder 2007. But I put together a quick demo based on the SslMailSnd project to test for the problem. It's a very small project _only_ intended to test for failed handshake--nothing more. My demo resulted in the same problem that my program has. It fails the handshake. Here are my results. 16:24:12 < 220 mx.google.com ESMTP gq2sm7031513bkc.13 16:24:12 RequestDone Rq=0 Error=0 16:24:12 > EHLO CADILLAC 16:24:12 < 250-mx.google.com at your service, [72.160.14.31] 16:24:12 < 250-SIZE 35882577 16:24:12 < 250-8BITMIME 16:24:12 < 250-STARTTLS 16:24:12 < 250 ENHANCEDSTATUSCODES 16:24:12 RequestDone Rq=10 Error=0 16:24:12 > STARTTLS 16:24:13 < 220 2.0.0 Ready to start TLS 16:24:13 Starting SSL handshake 16:34:12 Handshake done! 16:34:12 SSL Handshake failed 16:34:12 RequestDone Rq=12 Error=500 Thanks for any help you can provide. George I'm pasting my cbuilder mainform unit below: //-------------------------------------------------------------------- ------- #ifndef mainformH #define mainformH //-------------------------------------------------------------------- ------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include "OverbyteIcsSmtpProt.hpp" #include "OverbyteIcsWndControl.hpp" #include "OverbyteIcsWSocket.hpp" #include <ComCtrls.hpp> //-------------------------------------------------------------------- ------- class TForm1 : public TForm { __published: // IDE-managed Components TButton *ConnectButton; TSslSmtpCli *SslSmtpCli1; TSslContext *SslContext1; TRichEdit *DisplayMemo; void __fastcall SslSmtpCli1RequestDone(TObject *Sender, TSmtpRequest RqType, WORD ErrorCode); void __fastcall ConnectButtonClick(TObject *Sender); void __fastcall SslSmtpCli1Display(TObject *Sender, AnsiString Msg); void __fastcall SslSmtpCli1SslHandshakeDone(TObject *Sender, WORD ErrCode, TX509Base *PeerCert, bool &Disconnect); private: // User declarations public: // User declarations int FEhloCount; __fastcall TForm1(TComponent* Owner); void __fastcall Display(const AnsiString &Msg); }; //-------------------------------------------------------------------- ------- extern PACKAGE TForm1 *Form1; //-------------------------------------------------------------------- ------- #endif //-------------------------------------------------------------------- ------- #include <vcl.h> #pragma hdrstop #include "mainform.h" //-------------------------------------------------------------------- ------- #pragma package(smart_init) #pragma link "OverbyteIcsSmtpProt" #pragma link "OverbyteIcsWndControl" #pragma link "OverbyteIcsWSocket" #pragma resource "*.dfm" TForm1 *Form1; //-------------------------------------------------------------------- ------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { FEhloCount = 0; SslSmtpCli1->Host = "smtp.gmail.com"; SslSmtpCli1->Port = "25"; SslContext1->SslVerifyPeer = false; SslSmtpCli1->SslType = smtpTlsExplicit; DisplayMemo->Clear(); } //-------------------------------------------------------------------- ------- void __fastcall TForm1::SslSmtpCli1RequestDone(TObject *Sender, TSmtpRequest RqType, WORD ErrorCode) { // For every operation, we display the status } Display("RequestDone Rq=" + IntToStr(RqType) + " Error=" + IntToStr(ErrorCode)); switch (RqType) { case smtpConnect: SslSmtpCli1->Ehlo(); break; case smtpEhlo: if (SslSmtpCli1->SslType == smtpTlsExplicit) { FEhloCount++; if (FEhloCount == 1) SslSmtpCli1->StartTls(); } break; case smtpStartTls: SslSmtpCli1->Ehlo(); // We need to re-issue Ehlo break; } } //-------------------------------------------------------------------- ------- void __fastcall TForm1::Display(const AnsiString &Msg) { AnsiString time = FormatDateTime("hh:nn:ss ", Now()); DisplayMemo->Lines->BeginUpdate(); try { DisplayMemo->Lines->Add(time+Msg); } __finally { DisplayMemo->Lines->EndUpdate(); SendMessage(DisplayMemo->Handle, EM_SCROLLCARET, 0, 0); } } //-------------------------------------------------------------------- ------- void __fastcall TForm1::ConnectButtonClick(TObject *Sender) { SslSmtpCli1->Connect(); } //-------------------------------------------------------------------- ------- void __fastcall TForm1::SslSmtpCli1SslHandshakeDone(TObject *Sender, WORD ErrCode, TX509Base *PeerCert, bool &Disconnect) { Display("Handshake done!"); } //-------------------------------------------------------------------- ------- void __fastcall TForm1::SslSmtpCli1Display(TObject *Sender, AnsiString Msg) { Display(Msg); } //-------------------------------------------------------------------- ------- -- 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