解码标题
function TfrmShowMail.DE(str:string):string;
var
r : TRegExpr;
tmp:string;
begin
r := TRegExpr.Create;
//r.Expression := '=/?(.*)/?';
r.Expression := '=/?(GBK|GB2312|UTF-8)/?';
r.Exec(UpperCase(str));
//str:=r.Match[0];
tmp:= r.Substitute ('$1');
r.Free;
str:=copy(str,length(tmp)+6,length(str));
str:=IdDecoderMIME1.DecodeString(str);
if tmp = 'UTF-8' then
begin
str:=unicode2gb(str);
end
else
begin
end;
result:= str;
end;