Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi 2007 .net INDY 10.5 mit TLS / SSL Fehler BUFFER TERMINATOR must be specified (https://www.delphipraxis.net/157581-delphi-2007-net-indy-10-5-mit-tls-ssl-fehler-buffer-terminator-must-specified.html)

Digielm 17. Jan 2011 12:27

Delphi-Version: 2007

Delphi 2007 .net INDY 10.5 mit TLS / SSL Fehler BUFFER TERMINATOR must be specified
 
Hallo Leute,

ich habe ein kleines Problem

ich hab einen Source gefunden mit dem ich Mails via SMTP mit TLS / SSL versenden kann.

Ich habe jetzt versucht das ganze auch mit Delphi 2007 dot NET umzusetzen, leider kriege ich das nicht so ganz hin.

Kann mir jemand damit helfen wie ich in dot net SLL / TLS mit Indy 10.5.7 via SMTP machen kann.

Als Fehlermeldung erhalte ich immer
"BUFFER TERMINATOR must be specified'

Kann jemand damit was anfangen ?

Delphi-Quellcode:
var
   MsgSend:TIdMessage;
   SMTP:TIdSMTP;
   SASLNTLM : TIdSASLLogin;
   UserPassProv:TIdUserPassProvider;
   sentOK:Boolean;
   sslhandler : TIdSSLIOHandlerSocketNET;
begin
  MsgSend:=TIdMessage.Create; //create the message
  with MsgSend do
     begin
        Body.Text:=#13+'Dies ist eine Test E-Mail';
        From.Text := edsmtpusermailaddress.text;
        Recipients.EMailAddresses := edsmtpusermailaddress.text;
        Subject := 'Info E-Mail durch '+caption;   // set the subject
        Priority := mpNormal; // set the priority (note that you could add to
                               // Destination to support different priorities)
     end;
  try
    SMTP:=TIdSMTP.Create;    //create the SMTP object
    try
      smtp.IOHandler := TIdSSLIOHandlerSocketNET.create; //if we succeed, then we can create a SSL socket handler and assign it to the IOHandler
      smtp.UseTLS := utUseExplicitTLS;                                //and we can mark the we can use tls

    except
      smtp.IOHandler := TIdIOHandler.MakeDefaultIOHandler(smtp);      //the SSL failed to create, so make the default IO handler
      smtp.UseTLS := utNoTLSSupport;                                  //mark that we have no TLS support
   end;
   smtp.ManagedIOHandler := True;   //either way, we now have a ManagedIOHandler

    try
      SMTP.AuthType := satSASL;
      SMTP.UserName := 'SMTPUSERNAME';       // User Input
      SMTP.Password := 'SMTPPASSWORD';   // User Input

      userPassProv:=TIdUserPassProvider.Create; //create the user/pass provider - this handles the login functions for SASL
      userPassProv.UserName:=SMTP.UserName;     // setup user name
      userPassProv.Password:=SMTP.Password;     // & password

      if SMTP.AuthType=satSASL then //if we are going to use SASL - basically, SASL just encrypts the login, everything else is still clear text
        begin
         SASLNTLM := TIdSASLLogin.Create;
         SASLNTLM.UserPassProvider:=userPassProv;
         SMTP.SASLMechanisms.Clear;
         SMTP.SASLMechanisms.Add.SASL:=SASLNTLM;
        end;
      {General setup}
      SMTP.Host := 'smtpip';            //setup the server name
      SMTP.Port := 25; //setup the server port

      {now we send the message}
      SMTP.ConnectTimeout := 1000;
      SMTP.Connect;
      if not SMTP.Authenticate then                                   //authenticate with the server - this will automatically use SASL if configured and supported
      begin
        MessageDlg('An error occurred attempting to send your e-mail. The error was : Unable to authenticate.', mtError, [mbOK], 0);
        exit;
      end;
      try
         try
//           ShowMessage('Before Send');
           SMTP.Send(MsgSend); //send the message
//           ShowMessage('After Send');
           SentOk:=true;       //indicate success
         finally
            SMTP.Disconnect;                                          //disconnect from the server
         end;
      except on E :Exception do                                       //if we had a failure, say so
         begin
         MessageDlg('An error occurred attempting to send your e-mail. The error was : '+E.Message, mtError, [mbOK], 0);
         SentOk:=false;                                               //set failure
         end;
      end;
    finally
    SMTP.Free;                                                        //free the memory
    end;
  finally
//     if logFile<>nil then                                             //if we had a log file, free that
//        logFile.Free;
     MsgSend.Free;                                                    //free the message
  end;

Digielm 20. Jan 2011 09:01

AW: Delphi 2007 .net INDY 10.5 mit TLS / SSL Fehler BUFFER TERMINATOR must be specifi
 
Hallo zusammen,

ich habe noch rausbekommen, das ich überhaupt keine Mail raussenden kann auch nicht über den Standard SMTP Port 25 ohne Verschlüsselung.

Es kommt immer der selbe Fehler egal was ich mache. Auch ist es nicht relevant ob ich pop3 before smtp oder alles ohne auth mache.

Wäre gut wenn mir da ggf. jemand helfen kann.

Bernhard Geyer 20. Jan 2011 09:05

AW: Delphi 2007 .net INDY 10.5 mit TLS / SSL Fehler BUFFER TERMINATOR must be specifi
 
Zitat:

Zitat von Digielm (Beitrag 1075260)
Ich habe jetzt versucht das ganze auch mit Delphi 2007 dot NET umzusetzen, leider kriege ich das nicht so ganz hin.

Du weist aber schon das der Delphi.NET gestorben ist. Hier Zeit zu investieren ist verschwendung.
Was passiert wenn du das mit Delphi.Win32 probierst?

Digielm 20. Jan 2011 11:37

AW: Delphi 2007 .net INDY 10.5 mit TLS / SSL Fehler BUFFER TERMINATOR must be specifi
 
Hallo

ja ich weiß das Delphi.net gestorben ist, nur leider kann ich das kompl. Produkt nicht einfach mal so neuentwickeln.

In der WIn32 Variante läuft alles ohne Probleme.


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:54 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz