//要用到INDY里的两个类
//对邮件中的信息进行QP 或 BASE64(MIME) 解码
Function Decode(s:string):string;
var
i : integer;
ls_stream : TStringStream;
s_temp : string;
MyDecoderQ : TIdDecoderQuotedPrintable;
MyDecoderB : TIdDecoderMIME;
begin
ls_stream := TStringStream.Create('');
i := Pos('?Q?',s);
if i > 0 then
begin
s_temp := copy(s,i+3,length(s)-(i+2)-2);
MyDecoderQ.decodetostream(s_temp,ls_stream);
Result := ls_stream.DataString;
end
else
begin
i := pos('?B?',s);
if i > 0 then
begin
s_temp := copy(s,i+3,length(s)-(i+2)-2);
MyDecoderB.decodetostream(s_temp,ls_stream);
Result := ls_stream.DataString;
end
else
begin
Result := s;
end
end;
end;
//对邮件中的信息进行QP 或 BASE64(MIME) 解码
Function Decode(s:string):string;
var
i : integer;
ls_stream : TStringStream;
s_temp : string;
MyDecoderQ : TIdDecoderQuotedPrintable;
MyDecoderB : TIdDecoderMIME;
begin
ls_stream := TStringStream.Create('');
i := Pos('?Q?',s);
if i > 0 then
begin
s_temp := copy(s,i+3,length(s)-(i+2)-2);
MyDecoderQ.decodetostream(s_temp,ls_stream);
Result := ls_stream.DataString;
end
else
begin
i := pos('?B?',s);
if i > 0 then
begin
s_temp := copy(s,i+3,length(s)-(i+2)-2);
MyDecoderB.decodetostream(s_temp,ls_stream);
Result := ls_stream.DataString;
end
else
begin
Result := s;
end
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货