据我所知,delphi和windows里没有这样现成的函数
这事我以前做过,我给你找找有关资料和代码吧。不过只有15分...
这事我以前做过,我给你找找有关资料和代码吧。不过只有15分...
解决方案 »
- 感慨ying,程序猿不容易啊
- 求助Twebbrower的关于word的问题
- DELPHI交流群 欢迎大家交流
- 兼职的电脑软、硬件维护及对以前提供的软件进行一些功能完善,签约要注意什么?
- 怎么把一个字符串处理后加入到一个combobox里?
- 如何实现点对点通讯???
- FastReport在打印预览选择纸张时为何不能选择自定义纸张
- delphi7 如何实现数据库的备份与还原
- 偶不明白:locate函数的:loCaseInsensitive方式与lopartialkey方式各代表什么意思?
- 请问如何重新编译VCL50.bpl中已经含的内容??
- 如何用DELPHI做像WROD那样的标尺
- 寻画线控件,能在其他图形控件上画线
处理电子邮件要做的工作很多,要了解个叫MIME的标准。你需要看RFC2045,2046,2110,2111,2112等等了解详细情况。要让EMAIL里没有乱码不是件容易的事,有很多种情况需要处理
下面是两种编码方式的解码原代码,在原始数据里有"content-type"标志指示编码方式.如果还有问题再说吧,一时说不完,下班回家打游戏了...
********************************************************************
//解析'BASE64'编码方式的内容
Function DecodeBase64(Const Data:String):String;
var
i,j:Integer;
m,n:array[1..256] of byte;
str:string;
tmpStringList:TStringList;
Ret: String;
begin
tmpStringList:= TStringList.Create;
try
tmpStringList.Text:=Data;
Ret:='';
for i:=0 to tmpStringList.Count-1 do begin
str:=tmpStringList.Strings[i];
for j:=1 to length(str) do begin
case str[j] of
'A'..'Z': m[j]:=ord(str[j])-ord('A');
'a'..'z': m[j]:=ord(str[j])-ord('a')+26;
'0'..'9': m[j]:=ord(str[j])-ord('0')+52;
'+' : m[j]:=62;
'/' : m[j]:=63;
'=' : m[j]:=64;
end;
end;
for j:=1 to ((length(str)+3) shr 2) do begin
n[3*j-2]:=(m[(j shl 2)-3] shl 2)or(m[(j shl 2)-2] shr 4);
n[3*j-1]:=(m[(j shl 2)-2] shl 4)or(m[(j shl 2)-1] shr 2);
n[3*j]:=(m[(j shl 2)-1] shl 6)or(m[(j shl 2)]);
if m[(j shl 2)-3]=64 then continue;
Ret:= Ret+Chr(n[3*j-2]);
if m[(j shl 2)-1]=64 then continue;
Ret:= Ret+Chr(n[3*j-1]);
if m[(j shl 2)]=64 then continue;
Ret:= Ret+Chr(n[3*j]);
end;
end;
if Assigned(tmpStringList) then begin
tmpStringList.Free;
tmpStringList:=nil;
end;
Except
if Assigned(tmpStringList) then begin
tmpStringList.Free;
tmpStringList:=nil;
end;
end;
Result:=Ret;
end;//解析'ISO-8859-1'编码方式的内容
Function DecodeISO(Const Data:String):String;
Var
DataLen,I,tmpInt:Integer;
Ret:String;
begin
Ret:='';
I:=1;
try
DataLen:=Length(Data);
ProtectCount := 0;
While I<=DataLen do begin
inc(ProtectCount);
if ProtectCount > 5000 then break;
if (Data[i]='=')And(I<DataLen-1) then begin
try
tmpInt:=(HextoDec(Data[i+1]) shl 4)+HextoDec(Data[i+2]);
Ret:= Ret+Chr(tmpInt);
i:=i+3;
except
end;
end
else begin
Ret:= Ret+Data[i];
I:=I+1;
end;
end;
except
end;
Result:=Ret;
end;
现在的问题是如果对方用GB2312发过来时显示不正常。(Body正常,只有Subject不正常)
如:发送时标题是:"爱人解放了"
接收时标题是:"=?GB_2312-80?Q?=B0=AE=C8=CB=BD=E2=B7=C5=C1=CB?="