* * *

Author Topic: Synapse,pop3send with SSL cannot login hotmail server  (Read 1662 times)

goomoo

  • New member
  • *
  • Posts: 11
Synapse,pop3send with SSL cannot login hotmail server
« on: November 09, 2016, 11:17:23 am »
I have referred the Synapse's sample article at

http://synapse.ararat.cz/doku.php/public:howto:pop3samplessl

and tried using SSLv2 and SSLv3 to login hotmail pop3 server,

always login failed , Where is the problem?

Thanks alot.

Code: Pascal  [Select]
  1.  
  2. unit Unit1;
  3.  
  4. {$mode objfpc}{$H+}
  5.  
  6. interface
  7.  
  8. uses
  9.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  10.   pop3send,blcksock;
  11.  
  12. type
  13.  
  14.   { TForm1 }
  15.  
  16.   TForm1 = class(TForm)
  17.     btnTest: TButton;
  18.     Button1: TButton;
  19.     Memo1: TMemo;
  20.     procedure btnTestClick(Sender: TObject);
  21.     procedure Button1Click(Sender: TObject);
  22.  
  23.     procedure AddToLog(s:string);
  24.   private
  25.     { private declarations }
  26.   public
  27.     { public declarations }
  28.   end;
  29.  
  30.   ESMTP = class (Exception);
  31.   EPOP3 = class (Exception);
  32.  
  33. var
  34.   Form1: TForm1;
  35.  
  36. implementation
  37.  
  38. {$R *.lfm}
  39.  
  40. { TForm1 }
  41.  
  42. procedure TForm1.btnTestClick(Sender: TObject);
  43. var
  44.   pop3:TPop3Send;
  45.   ok:boolean;
  46.   s:string;
  47. begin
  48.   pop3:=TPop3Send.Create;
  49.   pop3.TargetHost:='pop-mail.outlook.com';
  50.   pop3.TargetPort:='995';
  51.   pop3.AutoTLS:=false;
  52.   pop3.FullSSL:=true;
  53.   //pop3.AuthType:=TPop3AuthType.POP3AuthAll;
  54.   pop3.Sock.SSL.SSLType:=TSSlType.LT_SSLv2;
  55.   pop3.UserName:='goomoozeng@hotmail.com';
  56.   pop3.Password:='password';
  57.  
  58.  
  59.  
  60.   ok:=pop3.Login;
  61.  
  62.   if ok then
  63.   begin
  64.     ShowMessage('login ok');
  65.     pop3.Logout;
  66.   end
  67.   else
  68.   begin
  69.     ShowMessage('login failed!');
  70.     s:=ansiToUtf8(pop3.ResultString);
  71.     ShowMessage(s);
  72.   end;
  73.  
  74.   pop3.Free;
  75.  
  76. end;
  77.  
  78.  
  79.  
  80. procedure TForm1.Button1Click(Sender: TObject);
  81. var
  82.   pop3: TPOP3Send;
  83.   i: integer;
  84. begin
  85.   pop3 := TPOP3Send.Create();
  86.   try
  87.     pop3.AutoTLS := false;
  88.     pop3.Username:='goomoozeng@hotmail.com';
  89.     pop3.Password:='password';
  90.     pop3.TargetHost:='pop-mail.outlook.com';
  91.     pop3.TargetPort := '995';
  92.     pop3.FullSSL := true;
  93.     pop3.Sock.SSL.SSLType := LT_SSLv2;
  94.  
  95.     pop3.Sock.SSLDoConnect();
  96.     if not pop3.Login() then
  97.       raise EPOP3.Create('POP3 ERROR: Login');
  98.  
  99.     AddToLog('POP3 Stat');
  100.     if not pop3.Stat() then
  101.       raise EPOP3.Create('POP3 ERROR: stat');
  102.     AddToLog('Stat: '+IntToStr(pop3.StatCount)+' msgs');
  103.     for i := 1 to pop3.StatCount do begin
  104.       AddToLog('POP3 Retr(' + IntToStr(i) + ')');
  105.       if not pop3.Retr(i) then
  106.         raise EPOP3.Create('POP3 ERROR: retr(' + IntToStr(i) + ')');
  107.       Memo1.lines.Add(' ');
  108.       Memo1.lines.Add('*** POP3 Retr(' + IntToStr(i) + ') *******');
  109.       Memo1.lines.AddStrings(pop3.FullResult);
  110.       pop3.FullResult.SaveToFile('mail_' + IntToStr(i) + '.msg');
  111.       if not pop3.Dele(i) then
  112.         raise EPOP3.Create('POP3 ERROR: dele(' + IntToStr(i) + ')');
  113.     end;
  114.  
  115.   finally
  116.     pop3.Free;
  117.   end;
  118.  
  119. end;
  120.  
  121. procedure TForm1.AddToLog(s: string);
  122. begin
  123.   self.Memo1.Append(s);
  124. end;
  125.  
  126. end.
  127.  
  128.  

goomoo

  • New member
  • *
  • Posts: 11
Re: Synapse,pop3send with SSL cannot login hotmail server
« Reply #1 on: November 09, 2016, 12:14:45 pm »

When I tracked into TPOP3Send.Connect function,  I got the errorcode and error message are:

FLASTERROR = 10091,
FLASTERRORDESC = 'SSL/TLS support is not compiled!'

then the function returns False.

How to compile SSL/TSL support ?

Code: [Select]
function TPOP3Send.Connect: Boolean;
begin
  // Do not call this function! It is calling by LOGIN method!
  FStatCount := 0;
  FStatSize := 0;
  FSock.CloseSocket;
  FSock.LineBuffer := '';
  FSock.Bind(FIPInterface, cAnyPort);
  if FSock.LastError = 0 then
    FSock.Connect(FTargetHost, FTargetPort);
  if FSock.LastError = 0 then
    if FFullSSL then
      FSock.SSLDoConnect;
  Result := FSock.LastError = 0;   

  //----> When goes there, FSock.LastError=10091, FLASTERRORDESC = 'SSL/TLS support is not compiled!',

end;


DonAlfredo

  • Hero Member
  • *****
  • Posts: 795
Re: Synapse,pop3send with SSL cannot login hotmail server
« Reply #2 on: November 09, 2016, 12:24:09 pm »
Add:

Code: Pascal  [Select]
  1. Uses
  2.  ...., ssl_openssl;

Could work !

goomoo

  • New member
  • *
  • Posts: 11
Re: Synapse,pop3send with SSL cannot login hotmail server
« Reply #3 on: November 09, 2016, 12:48:43 pm »
Add:

Code: Pascal  [Select]
  1. Uses
  2.  ...., ssl_openssl;

Could work !

Thank you,DonAlfredo  :)  , after I added ssl_openssl uses clauses, I got another error code and error message:

FLASTERROR = 10091,
FLASTERRORDESC = 'error:140650B5:SSLroutines:CLIENT_HELLO:no ciphers available'



DonAlfredo

  • Hero Member
  • *****
  • Posts: 795
Re: Synapse,pop3send with SSL cannot login hotmail server
« Reply #4 on: November 09, 2016, 01:08:19 pm »
Mmmm ... dunno ...
Try: pop3.live.com ?
Or try another tls protocol ?

PaVuk

  • Newbie
  • Posts: 1
Re: Synapse,pop3send with SSL cannot login hotmail server
« Reply #5 on: June 01, 2017, 11:57:21 pm »
Hi,

Two .dll-s from synapse library have to present
libeay32.dll
ssleay32.dll

Yes, I believe you've resolved it by now somehow, but someone is going to ask it again in few months... I've just experienced (and resolved) it now.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus