前言
現在很多STMP服務器在發送郵件時均需重新認證一遍
由於前段時間在做《CSDN查詢助手》的時候
實現
var strUserName
begin
strUserName := EncodeString(
strPassword := EncodeString(
{進行認證
nmsmtp
nmsmtp
nmsmtp
nmsmtp
StatusBar
end;
{對參數Decoded字符串進行Base
function EncodeString(Decoded:string):String;
var
mmTemp
strTemp:TStrings;
begin
mmTemp := TMemoryStream
mmDecoded:=TMemoryStream
strTemp:=TStringList
strTemp
strTemp
mmTemp
{剔除mmTemp從strTemp中帶來的字符#
mmDecoded
{對mmDecoded進行Base
EncodeBASE
{獲得Base
mmTemp
strTemp
{返回結果必須從strTemp[
帶來不必要的字符#
Result:=strTemp[
end;
function EncodeBASE
const
_Code
(
var
I: LongInt;
B: array[
J
Stream: string[
EncLine: String;
begin
Encoded
Stream :=
Quads :=
{為提高效率
J := Decoded
Decoded
{對前J*
for I :=
begin
Decoded
for M :=
begin
for K :=
begin
L:=
Stream[Quads+
Stream[Quads+
Stream[Quads+
Stream[Quads+
Inc(Quads
if Quads =
begin
Stream[
EncLine := Stream+#
Encoded
Quads :=
end;
end;
end;
end;
{對以
J := (Decoded
for I :=
begin
Decoded
Stream[Quads+
Stream[Quads+
Stream[Quads+
Stream[Quads+
Inc(Quads
{每行
if Quads =
begin
Stream[
EncLine := Stream+#
Encoded
Quads :=
end;
end;
{
if (Decoded
begin
Decoded
Stream[Quads+
Stream[Quads+
Stream[Quads+
Stream[Quads+
Inc(Quads
end;
if (Decoded
begin
Decoded
Stream[Quads+
Stream[Quads+
Stream[Quads+
Stream[Quads+
Inc(Quads
end;
Stream[
if Quads >
begin
EncLine := Stream+#
Encoded
end;
Result := Encoded
end;
From:http://tw.wingwit.com/Article/program/Delphi/201311/25054.html