Z
zslg1
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大哥:
在本论坛看到有以下代码,据说可以改进sakemail的smtp认证问题,可是下面的这段
代码怎么去使用啊?该放在那儿,怎么调用?
小弟拜托了!
function TSakSMTP.Authenticate: boolean;
function AuthLogin: Boolean;
var
Base64: TBase64;
stemp: string;
begin
FSendTextToSocket('auth LOGIN' + crlf);
FReceiveTextFromSocket;
if FReplyCode <> '334' then
begin
Result := false;
exit;
end;
Base64 := TBase64.Create;
Base64.EncodeData(UserID, stemp);
FSendTextToSocket(stemp + crlf);
FReceiveTextFromSocket;
if (FReplyCode <> '235') and (FReplyCode <> '334') then
begin
Result := false;
Base64.Free;
exit;
end;
stemp:='';
Base64.EncodeData(Password, stemp);
FSendTextToSocket(stemp + crlf);
FReceiveTextFromSocket;
if FReplyCode <> '235' then
begin
Result := false;
Base64.Free;
exit;
end;
Base64.Free;
Result := True;
end;
begin
Result := False;
case FAUthenticationType of
atLogin: Result := AuthLogin;
end;
FDidAuthenticate := True;
end;
在本论坛看到有以下代码,据说可以改进sakemail的smtp认证问题,可是下面的这段
代码怎么去使用啊?该放在那儿,怎么调用?
小弟拜托了!
function TSakSMTP.Authenticate: boolean;
function AuthLogin: Boolean;
var
Base64: TBase64;
stemp: string;
begin
FSendTextToSocket('auth LOGIN' + crlf);
FReceiveTextFromSocket;
if FReplyCode <> '334' then
begin
Result := false;
exit;
end;
Base64 := TBase64.Create;
Base64.EncodeData(UserID, stemp);
FSendTextToSocket(stemp + crlf);
FReceiveTextFromSocket;
if (FReplyCode <> '235') and (FReplyCode <> '334') then
begin
Result := false;
Base64.Free;
exit;
end;
stemp:='';
Base64.EncodeData(Password, stemp);
FSendTextToSocket(stemp + crlf);
FReceiveTextFromSocket;
if FReplyCode <> '235' then
begin
Result := false;
Base64.Free;
exit;
end;
Base64.Free;
Result := True;
end;
begin
Result := False;
case FAUthenticationType of
atLogin: Result := AuthLogin;
end;
FDidAuthenticate := True;
end;