Jump to content

GillesL.

Members
  • Content Count

    10
  • Joined

  • Last visited

Posts posted by GillesL.


  1.  The problem was with th TSSLContext. I duplicated the settings from the sample code and everything worked. The issue was in the SSLOptions I am not sure which one was causing the problem:

    [sslOpt_MICROSOFT_SESS_ID_BUG,sslOpt_NETSCAPE_CHALLENGE_BUG,sslOpt_NETSCAPE_REUSE_CIPHER_CHANGE_BUG,sslOpt_MICROSOFT_BIG_SSLV3_BUFFER,sslOpt_SSLEAY_080_CLIENT_DH_BUG,sslOpt_TLS_D5_BUG,sslOpt_TLS_BLOCK_PADDING_BUG,sslOpt_TLS_ROLLBACK_BUG,sslOpt_NO_SSLv2,sslOpt_NO_SSLv3,sslOpt_NETSCAPE_CA_DN_BUG,sslOpt_NETSCAPE_DEMO_CIPHER_CHANGE_BUG]

    I do appreciated the suggestion about using Rest instead and I will rewrite my code to do so. Thanks for the response.


  2. Can someone point me out in the right direction please. I used the following code in 2 different programs. One works the other fails because the "Document" file does not get created...

     

    const Document : string = 'c:\temp\rcvdata.txt';

     

    function TForm5.PostURL(URL, HeaderKey, HeaderValue, Data: string): string;
    var S: TStringList;
    begin
      if FileExists(Document) then
        DeleteFile(Document);
      S:= TStringList.Create;
      try
        if HeaderKey <> '' then
        begin
          SslHttpCli1.ExtraHeaders.Add(HeaderKey + ': ' + HeaderValue);
        end;
        SslHttpCli1.SendStream := TMemoryStream.Create;
        SslHttpCli1.SendStream.Write(Data[1], Length(Data));
        SslHttpCli1.SendStream.Seek(0, 0);
        SslHttpCli1.RcvdStream      := TMemoryStream.Create;  //not to sure about this see HTTPDocBegin
        SslHttpCli1.URL             := Trim(URL);
        SslHttpCli1.ContentTypePost := 'application/json';
        SslHttpCli1.Post;
        S.LoadFromFile(Document);
        Result:= S.Text;
        Memo1.Lines.Add('DATA SENT:');
        Memo1.Lines.Add(Data);
        Memo1.Lines.Add('RESPONSE:');
        Memo1.Lines.Add(Result);
      finally
        S.Free;
      end;
    end;

     

    procedure TForm5.SslHttpCli1BeforeHeaderSend(Sender: TObject; const Method: string;
      Headers: TStrings);
    begin
      Memo1.Lines.Add('HEADERS:');
      Memo1.Lines.add(Headers.text);
    end;

     

    procedure TForm5.SslHttpCli1DocBegin(Sender: TObject);
    begin
      FByteCount:= 0;
      SslHttpCli1.RcvdStream := TFileStream.Create(Document, fmCreate);
    end;

     

    procedure TForm5.SslHttpCli1DocData(Sender: TObject; Buffer: Pointer; Len: Integer);
    begin
      Inc(FByteCount, Len);
    end;

     

    procedure TForm5.SslHttpCli1DocEnd(Sender: TObject);
    begin
      if Assigned(SslHttpCli1.RcvdStream) then
      begin
        SslHttpCli1.RcvdStream.Free;
        SslHttpCli1.RcvdStream := nil;
      end;
    end;


     


  3. Windows 10, icsv864, Delphi 10.4, VCL app using SMTPClient...

     

    I have an app which runs in the background and must send an email (unattended) when a certain event takes place. From time to time the app stops because the component  is not smtpReady:

     

    procedure TCustomSmtpClient.CheckReady;
    begin
        if not (FState in [smtpReady, smtpInternalReady]) then
          raise SmtpException.Create('SMTP component not ready');
    end;
     

    Is it possible to have a quiet exception, no need for user to click OK, and have the app recover and continue to work.

     

    Anyone has experience with something like this:

     

    procedure TCustomSmtpClient.CheckReady;
    begin
        while not (FState in [smtpReady, smtpInternalReady]) then

       begin

           Application.ProcessMessages; //not sure if it is warranted
          Sleep(1000); //maybe 100 would be sufficient

       end;
    end;
     

    Or maybe a better solution...

     


  4. I am having a problem using TSslSmtpCli (v8.55) in a console app (cgi) under windows 10 and Delphi Tokyo (10.2.3). The problem is I can not assign a procedure (created as a TSmtpRequestDone) to the event OnRequestDone since procedures and methods are not compatible. Using a Form provides a mechanism to do so but creates another problem since the app is a console app and I end up with a run time error 216 as the app terminates. Is there any other way other than creating a new component using TCustomSslSmtpCli as a base.

×