Using Delphi, Intraweb, Indy. There are no problems sending an email (SMTP) in the IDE (runtime). But I get the error: "SSL Negotiation failed" using an ISAPI-dll while trying to Authenticate. libeay32.dll and ssleay32.dll are in the same directory as the ISAPI-dll.
Any ideas? Thanks, Andreas
function NetSendMail(cTo, cSubject, cBody: String; cFrom: String = ''): Boolean;
var
oIdSMTP: TIdSMTP;
oIdMessage: TIdMessage;
oIdSSLIOHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
result := False;
oIdSMTP := nil;
oIdMessage := nil;
try
oIdSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(Application);
oIdSSLIOHandler.SSLOptions.Mode := sslmClient;
oIdSMTP := TIdSMTP.Create(Application);
oIdSMTP.IOHandler := oIdSSLIOHandler;
oIdSMTP.UseTLS := utUseExplicitTLS;
oIdSMTP.Host := 'smtp.strato.de';
oIdSMTP.Port := 587;
oIdSMTP.Username := '***';
oIdSMTP.Password := '***';
oIdMessage := TIdMessage.Create(Application);
with oIdMessage do
begin
Recipients.Add().Address := cTo;
Subject := cSubject;
Body.Add(cBody);
if cFrom <> '' then
From.Address := cFrom
else
From.Address := 'absender@sesamsoft.de';
end;
with oIdSMTP do
try
AuthType := satDefault;
try
if not Connected() then
Connect();
except
on E: Exception do
begin
MsgShowMessage('Connect: ' + E.Message);
result := False;
exit;
end;
end;
try
Authenticate;
except
on E: Exception do
begin
MsgShowMessage('Auth: ' + E.Message);
result := False;
exit;
end;
end;
if not Connected() then
Connect();
Send(oIdMessage);
except
on E: Exception do
begin
MsgShowMessage(E.Message);
result := False;
exit;
end;
end;
finally
oIdSMTP.Disconnect;
FreeAndNil(oIdSMTP);
FreeAndNil(oIdMessage);
FreeAndNil(oIdSSLIOHandler);
end;
result := True;
end;
The answert couldn't help me. I included the code I'm using. It works fine with a "normal" desktop application. And it works aswell with INTRAWEB in runtime but not in the final ISAPI-dll. – Andreas