Autor Beitrag
Grafix
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Windows 7 Professional
Delphi 2009, PHP, Prolog, Python, Java
BeitragVerfasst: Di 03.04.12 20:57 
Hallo,

ich habe versucht mich mit Hotmail zu verbinden, und zwar mit folgendem (hier im Forum gefundenen) Code:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdPOP3, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    IdPOP31: TIdPOP3;
    IdMessage1: TIdMessage;
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Memo1.Clear;
  try
    IdPOP31.Host := 'pop3.live.com';
    IdPOP31.Port := 995;
    IdPOP31.Username := 'xy@xy.de';
    IdPOP31.Password := 'pass';
    IdPOP31.Connect;

    IdMessage1.NoDecode := true;

    if IdPOP31.Retrieve(1, IdMessage1) then
    begin
      Memo1.text:=(idMessage1.Body.GetText);
    end;

  finally
    IdPOP31.Disconnect;

  end;
end;

end.


beim Compillieren zeigt er keinerlei Fehler, er stoppt einfach, bzw braucht extrem lange, ab folgendem Ereignis:

Modul laden: WSHIP6.dll. Ohne Debug-Infos. Basisadresse: $731D0000. Prozess Project1.exe (7084)
Thread-Start: Thread-ID: 6684. Prozess Project1.exe (7084)

und dann wieder bei:
Modul laden: WindowsCodecs.dll. Ohne Debug-Infos. Basisadresse: $70FB0000. Prozess Project1.exe (7084)

Woran kann das liegen? Wenn ich die Verbindungsprozedur mit einem Button aktiviere, hängt das Programm erst dann...
Vielen Dank im Voraus,

Chris


Moderiert von user profile iconNarses: Topic aus Open Source Units verschoben am Di 03.04.2012 um 21:24
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10181
Erhaltene Danke: 1254

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 03.04.12 22:27 
Moin!

Port 995/TCP ist POP3/SSL, hast du das berücksichtigt?

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Grafix Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Windows 7 Professional
Delphi 2009, PHP, Prolog, Python, Java
BeitragVerfasst: Di 03.04.12 22:59 
Danke für die schnelle Rückmeldung,
dass der benötigte Port 995 ist, habe ich berücksichtigt. Bei der Verschlüsselung bin ich mir allerdings nicht sicher, wie ich diese festlege, vermutlich mit:

IdPOP31.UseTLS := ??

allerdings fehlt mir hierzu der entsprechende Parameter, wie müsste der lauten? utUseRequireSSL ?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10181
Erhaltene Danke: 1254

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 04.04.12 00:18 
Moin!

Hm, musste man da nicht irgendwelche DLLs dazutun oder so? :gruebel:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Grafix Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Windows 7 Professional
Delphi 2009, PHP, Prolog, Python, Java
BeitragVerfasst: Mi 04.04.12 12:55 
Wenn ich das wüsste... Ich hab den Code zum Verbinden so ähnlich auch hier im Forum und auch anderswo gefunden, allerdings war dort nie die Rede davon, dass noch irgendetwas zusätzlich gemacht werden muss...

Gibt es denn noch andere Möglichkeiten außer IdPOP3 mit Delphi sich zu Hotmail zu verbinden?

Nochetwas: wenn ich im Objektinspektor die Eigenschaft: "UseTLS" verändern möchte, sagt er: "Fehler: SSL IOHandler is required for this setting."

Und wenn ich ihn lange genug laden lasse kommt: "Erste Gelegenheit für Exception bei $75FFB9BC. Exception-Klasse EIdSocketError mit Meldung 'Socket Error # 10054 Connection reset by peer.'. Prozess Mail_Notifier.exe (5124)"
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mi 04.04.12 13:47 
Du musst erst den SSLHandler TIdSSLIOHandlerSocketOpenSSL auf die Form ziehen und der POP3-Komponente bei IOHandler zuweisen.

Außerdem müssen die OpenSSL-DLLs im Programmverzeichnis (Verzeichnis der EXE) oder im Windows-Verzeichnis liegen. Zum debuggen mit Delphi kann es außerdem notwendig sein die DLLs auch im Delphi\Bin\-Verzeichnis abzulegen.

www.slproweb.com/pro...ts/Win32OpenSSL.html

Du kannst auch die Dateien aus dem Anhang nehmen.

Moderiert von user profile iconNarses: Aus lizenzrechtlichen Gründen können wir die DLLs hier nicht hosten (deshalb tut´s das Indy-Project ja auch nicht), bitte von der angegebenen Quelle runterladen.
Grafix Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Windows 7 Professional
Delphi 2009, PHP, Prolog, Python, Java
BeitragVerfasst: Do 05.04.12 12:36 
Habe den Installer ausgeführt und kopien ins Windowsverzeichnis legen lassen, leider funktioniert es immer nocht nicht. Das nervige ist außerdem, dass jedes mal wenn das Programm sich aufhängt (nur wegen einem Verbindungsfehler?!) gleich die ganze Entwicklerumgebung abstürzt... ist das normal oder ist mein Delphi verbuggt?

Danke für die Antworten!
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 05.04.12 13:19 
user profile iconGrafix hat folgendes geschrieben Zum zitierten Posting springen:
Das nervige ist außerdem, dass jedes mal wenn das Programm sich aufhängt (nur wegen einem Verbindungsfehler?!)
Was heißt aufhängt? Dass die Oberfläche bis zum Timeout hängt? Das ist normal, da Indy blocking sockets benutzt. Dafür gibt es Threads, auch TIdAntiFreeze könnte helfen.

Zum eigentlichen Problem:
Kannst du vielleicht ein Beispielprojekt anhängen wie du es jetzt hast? ;-)
Grafix Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Windows 7 Professional
Delphi 2009, PHP, Prolog, Python, Java
BeitragVerfasst: Do 05.04.12 13:40 
Zitat:
Was heißt aufhängt?

Erstens hängt die Oberfläche bis zum Timeout, ja. Wenn ich das Programm nachdem der Fehler als PopUp angezeigt wurde schließen möchte, kann ich es danach nicht ein zweites mal mit F9 ausführen, und wenn ich Delphi dann schließe, stürzt es ab. Das mit TIdAntiFreeze werde ich mal ausprobieren, klingt ja sinnvoll.

Mein Programm hängt an, danke für die Bemühungen =)
Einloggen, um Attachments anzusehen!
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 05.04.12 15:51 
Ich habe es mir kurz angeschaut. Du versuchst Sachen hintereinander auszuführen, die eigentlich nicht so hintereinander gehören. Wenn sich der Status auf verbunden ändert, kannst du dich im Statusevent z.B. einloggen. Das Einloggen fehlt bei dir ganz. Hier findest du ein Beispiel:
freelivenet.org/word...nt-with-delphi-2007/
// EDIT:
Ach ja, und der Port ist noch falsch eingestellt, 995 wie im ersten Post war schon richtig.
Grafix Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Windows 7 Professional
Delphi 2009, PHP, Prolog, Python, Java
BeitragVerfasst: Do 05.04.12 16:12 
Danke erstmal. Mein Problem ist, dass er sich überhaupt nicht einloggt. Wenn ich nur den Host, den Username und das Passwort deklariere und dann die Funktion Connect aufrufe, dass geht bereits schief. Fehlermeldung: Connection colsed gracefully...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 05.04.12 17:07 
Wenn ich dazu noch den Port 995 angebe, geht das bei mir problemlos, vorausgesetzt die SSL-DLLs liegen im Verzeichnis. :nixweiss: