I tried the code
http://synapse.ararat.cz/doku.php/public:howto:smtpsend?s[]=addtolog
<http://synapse.ararat.cz/doku.php/public:howto:smtpsend?s%5b%5d=addtolog>
on the "how to" page with :
- lazarus 1.0.14   FPC 2.6.2  on a i386_win32 platform
- downloaded OpenSSL-097f-Win32 and OpenSSL-098d-Win32 from
http://synapse.ararat.cz/files/crypt/  and copied the dll files into the
project directory (alternatively for testing)

 

Modifications to the original source:

-  cancelled  out   //msg_lines.LoadFromFile(sFileName);

-  cancelled  out   //AddToLog('SMTP Logout');

- printed out  several TSMTP.properties for debugging after 
  -1) smtp.Login()

  -2) smtp.StartTLS()

  -3) smtp.MailFrom(sFrom, Length(sFrom))
and debugged the code:

step 1.) smtp.Login()  returns : true

 

TSMTP.properties after execution show:


ESMTPsize=TRUE

AUTHDONE= FALSE

FullSSL=  FALSE

ESMTP=    TRUE

AUTOTLS=  FALSE

PIPELINING

SIZE 41697280

8 BITMIME

STARTTLS

*

250-smtp.mail.yahoo.com

250-PIPELINING

250-SIZE 41697280

250-8 BITMIME

250 STARTTLS

 


step 2.) smtp.StartTLS() returns : true

 

TSMTP.properties after execution show:


ESMTPsize=TRUE

AUTHDONE= FALSE

FullSSL=  FALSE

ESMTP=    TRUE

AUTOTLS=  FALSE

PIPELINING

SIZE 41697280

8 BITMIME

STARTTLS

*

220 2.0.0 Start TLS

 

 

step 3.) .MailFrom(sFrom, Length(sFrom))  returns : false

 

TSMTP.properties after execution show:

 

ESMTPsize=TRUE

AUTHDONE= FALSE

FullSSL=  FALSE

ESMTP=    TRUE

AUTOTLS=  FALSE

PIPELINING

SIZE 41697280

8 BITMIME

STARTTLS

*

530 5.7.1 Authentication required


I tried with two e-mail providers :

- smtp.mail.yahoo.com on port 587

- mail.gmx.net on port 587

 

Both fails at step 3.)

 

Pls. help
Regards Chris

 

PS: here is the source code:

--------------------------------------------------------

 

program SMTP_TLS2;

 

uses classes, sysutils, smtpsend, ssl_openssl, blcksock {synafpc, synacode};

 

type

  ESMTP = class (Exception);

 

 

 

 

var usr,pwd,MFr,Mto,Hst,Prt,Dta:AnsiString;

 

// e-mail template (subject and other headers+CRLF+CRLF+e-mail body)

// in file sFileName

procedure MailSend(const sSmtpHost, sSmtpPort, sSmtpUser, sSmtpPasswd,
sFrom, sTo{,sFileName}: AnsiString);

var

  smtp: TSMTPSend;

  msg_lines: TStringList;

begin

  msg_lines := TStringList.Create;

  smtp := TSMTPSend.Create;

  try

    //msg_lines.LoadFromFile(sFileName);

    msg_lines.Insert(0, 'From: ' + sFrom);

    msg_lines.Insert(1, 'To: ' + sTo);

 

    smtp.UserName := sSmtpUser;

    smtp.Password := sSmtpPasswd;

    smtp.TargetHost := sSmtpHost;

    smtp.TargetPort := sSmtpPort;

 

    if not smtp.Login() then raise ESMTP.Create('SMTP ERROR: Login:' +
smtp.EnhCodeString);                   //step 1:true

    writeln('ESMTPsize=',smtp.ESMTPSize);

    writeln('AUTHDONE= ',smtp.authdone);

    writeln('FullSSL=  ',smtp.FullSSL);

    writeln('ESMTP=    ',smtp.ESMTP);

    writeln('AUTOTLS=  ',smtp.AutoTLS);

    writeln(smtp.ESMTPcap.text,' *'); writeln(smtp.FullResult.text);
writeln('--- Login'); writeln;writeln;

 

    if not smtp.StartTLS() then raise ESMTP.Create('SMTP ERROR: StartTLS:' +
smtp.EnhCodeString);      //step 2 : true

    writeln('ESMTPsize=',smtp.ESMTPSize);

    writeln('AUTHDONE= ',smtp.authdone);

    writeln('FullSSL=  ',smtp.FullSSL);

    writeln('ESMTP=    ',smtp.ESMTP);

    writeln('AUTOTLS=  ',smtp.AutoTLS);

    writeln(smtp.ESMTPcap.text,' *'); writeln(smtp.FullResult.text);
writeln('--- StartTLS'); writeln;writeln;

 

    if not smtp.MailFrom(sFrom, Length(sFrom)) then begin
//step 3:false

      writeln('ESMTPsize=',smtp.ESMTPSize);

      writeln('AUTHDONE= ',smtp.authdone);

      writeln('FullSSL=  ',smtp.FullSSL);

      writeln('ESMTP=    ',smtp.ESMTP);

      writeln('AUTOTLS=  ',smtp.AutoTLS);

      writeln(smtp.ESMTPcap.text,' *'); writeln(smtp.FullResult.text);
writeln('--- MailFrom'); writeln;writeln;

      raise ESMTP.Create('SMTP ERROR: MailFrom:' + smtp.EnhCodeString);

    end;

 

end;

 

 

 

 

 

 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to