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,
Smart mailto:[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
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public