Re: [Synalist] smtp sending and ssl (gmail)

2008-12-01 Thread Smart
...
uses ssl_openssl;
...

function TdmDocs.SendMyEmail_TLS(const MailFrom, MailTo, SMTPHost, SMTPPort: 
string;
  const MailData: TStrings; const Username, Password: string): Boolean;
var
  SMTP: TSMTPSend;
  s, t: string;
  msg_lines: TStringList;
  tmpStream: TStream;
begin
  Result := False;
  SMTP := TSMTPSend.Create;
  try
MailData.Insert(0, 'From: ' + MailFrom);
MailData.Insert(1, 'To: ' + MailTo);

SMTP.TargetHost := SMTPHost;
SMTP.TargetPort := SMTPPort;
SMTP.Username := Username;
SMTP.Password := Password;
//SMTP.FullSSL:= true;
SMTP.AutoTLS:= true;

if SMTP.Login then
begin
  try
if not smtp.Login() then
  raise ESMTP.Create('SMTP ERROR: Login:' + smtp.EnhCodeString);
//if not smtp.StartTLS() then
//  raise ESMTP.Create('SMTP ERROR: StartTLS:' + smtp.EnhCodeString);

if not smtp.MailFrom(MailFrom, Length(MailFrom)) then   
  raise ESMTP.Create('SMTP ERROR: MailFrom:' + 
smtp.EnhCodeString+#13#10+IntTostr(smtp.Sock.lasterror)+#13#10+IntToStr(smtp.sock.ssl.lasterror)+#13#10+smtp.sock.ssl.LastErrorDesc);
if not smtp.MailTo(MailTo) then
  raise ESMTP.Create('SMTP ERROR: MailTo:' + smtp.EnhCodeString);
if not smtp.MailData(MailData) then
  raise ESMTP.Create('SMTP ERROR: MailData:' + smtp.EnhCodeString);

if not smtp.Logout() then
  raise ESMTP.Create('SMTP ERROR: Logout:' + smtp.EnhCodeString);
  except on E: Exception do
begin
  if defShowEmailErrors and (DispatchPr <> 1) then
 MessageDlg('Ioeaea i?e ioi?aaeaiee 
email.'+Chr(13)+Chr(10)+E.Message+#13#10+smtp.EnhCodeString, mtError, [mbOK], 
0);
end;
  end;
end
else
  if defShowEmailErrors and (DispatchPr <> 1) then
 MessageDlg('Ioeaea: iao niaaeiaiey n SMTP-na?aa?ii.', mtError, [mbOK], 
0);
  finally
SMTP.Free;
  end;
end;

-
As you see our code match with that you wrote us.
And dll present in the catalogue with project an in the system one.
Unfortunatelly login doesn't happen 

in the function TSMTPSend.Login we get to condition

if (not FullSSL) and FAutoTLS and (FindCap('STARTTLS') <> '') then
  if StartTLS then
  begin
Ehlo;
FESMTPcap.Clear;
for n := 1 to FFullResult.Count - 1 do
  FESMTPcap.Add(Copy(FFullResult[n], 5, Length(FFullResult[n]) - 4));
  end
  else
  begin
Result := False;
Exit;
  end;

but StartTLS  return FALSE and TSMTPSend.Login return FALSE;


Thursday, November 27, 2008, 4:41:01 PM, you wrote:


>> We have problem that I describe below. How much we should donate to
>> receive fully functional code for sending email via gmail server?
>> Problem:

>> I try to send letter using gmail as SMTP-server
>> if i use port 587 then login successful, but when i try to execute
>> StartTLS i receive error:Su Success - Other undefined status--

LG> I write some reply to the synalist before a moment. Sorry for delay, 
LG> I am just little busy now.

-- 
Best regards,
 Smartmailto:[EMAIL PROTECTED]-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


Re: [Synalist] smtp sending and ssl (gmail)

2008-12-01 Thread Diego

Why do login twice???

the first "If smtp.login" make startTLS and do login on smtp server, why 
do the second?


Regards


Smart escribio':


...

uses ssl_openssl;

...


function TdmDocs.SendMyEmail_TLS(const MailFrom, MailTo, SMTPHost, 
SMTPPort: string;


  const MailData: TStrings; const Username, Password: string): Boolean;

var

  SMTP: TSMTPSend;

  s, t: string;

  msg_lines: TStringList;

  tmpStream: TStream;

begin

  Result := False;

  SMTP := TSMTPSend.Create;

  try

MailData.Insert(0, 'From: ' + MailFrom);

MailData.Insert(1, 'To: ' + MailTo);


SMTP.TargetHost := SMTPHost;

SMTP.TargetPort := SMTPPort;

SMTP.Username := Username;

SMTP.Password := Password;

//SMTP.FullSSL:= true;

SMTP.AutoTLS:= true;


if *SMTP.Login* then

begin

  try

if not *smtp.Login()* then

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

//if not smtp.StartTLS() then

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



if not smtp.MailFrom(MailFrom, Length(MailFrom)) then   

  raise ESMTP.Create('SMTP ERROR: MailFrom:' + 
smtp.EnhCodeString+#13#10+IntTostr(smtp.Sock.lasterror)+#13#10+IntToStr(smtp.sock.ssl.lasterror)+#13#10+smtp.sock.ssl.LastErrorDesc);


if not smtp.MailTo(MailTo) then

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

if not smtp.MailData(MailData) then

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



if not smtp.Logout() then

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

  except on E: Exception do

begin

  if defShowEmailErrors and (DispatchPr <> 1) then

 MessageDlg('Ioeaea i?e ioi?aaeaiee 
email.'+Chr(13)+Chr(10)+E.Message+#13#10+smtp.EnhCodeString, mtError, 
[mbOK], 0);


end;

  end;

end

else

  if defShowEmailErrors and (DispatchPr <> 1) then

 MessageDlg('Ioeaea: iao niaaeiaiey n SMTP-na?aa?ii.', 
mtError, [mbOK], 0);


  finally

SMTP.Free;

  end;

end;


-

As you see our code match with that you wrote us.

And dll present in the catalogue with project an in the system one.

Unfortunatelly login doesn't happen 



in the function TSMTPSend.Login we get to condition


if (not FullSSL) and FAutoTLS and (FindCap('STARTTLS') <> '') then

  if StartTLS then

  begin

Ehlo;

FESMTPcap.Clear;

for n := 1 to FFullResult.Count - 1 do

  FESMTPcap.Add(Copy(FFullResult[n], 5, Length(FFullResult[n]) 
- 4));


  end

  else

  begin

Result := False;

Exit;

  end;


but StartTLS  return FALSE and TSMTPSend.Login return FALSE;



Thursday, November 27, 2008, 4:41:01 PM, you wrote:



>> We have problem that I describe below. How much we should donate to

>> receive fully functional code for sending email via gmail server?

>> Problem:


>> I try to send letter using gmail as SMTP-server

>> if i use port 587 then login successful, but when i try to execute

>> StartTLS i receive error:Su Success - Other undefined status--


LG> I write some reply to the synalist before a moment. Sorry for delay, 


LG> I am just little busy now.


--

Best regards,

 Smartmailto:[EMAIL PROTECTED]



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/


___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public
  


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


Re: [Synalist] SynaSer - timing problem?

2008-12-01 Thread Richard
Hi all, 
I want to use one serial port for writing to and reading from
two different devices. Therefore I wanted to open the port for reading
and then close it again.

I have tried the following for the reading part:

PROCEDURE lesen;
var ser: TBlockSerial;
begin
repeat
ser:=TBlockSerial.Create;
ser.ConvertLineEnd := true;
ser.Connect(port1); 
data := ser.Recvstring(1000);
writeln(data);
ser.free;
until keypressed;   
end;

(The variable "data" will be exported to the program later).
Unfortunately the variable "data" contains only the last 10 to 15
characters (data has the type string[25]). It seemst to be a timing
problem. I have put a delay(500) before/after or both the data :=
...-expression, but without any positive results. Where is the mistake?

Thank you! 
Richard
-- 
Richard Müller - Am Spring 9 - D-58802 Balve-Eisborn
Ökologische Station in der JH Sorpesee
www.oeko-sorpe.de - www.wasserreise.info


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


[Synalist] pop3.logout

2008-12-01 Thread amos
hi there

i have a thread which i call several times, each time with a different mail 
server info to connect to. everything seemed to working just fine until
not long time ago when suddenly it seems that pop3.logout; command make the 
whole app stuck. currently this is a guess according to some
tests i did.

can u give me some hints on what can cause pop3.logout; command to get stuck?
thanks
-- -
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public