用indy9的idpop3收信后应该怎样解码?

sunseave 2004-05-08 03:54:36
请高手提供代码参考,谢谢
本人用的是DELPHI5
...全文
67 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
whxhz80 2004-05-13
  • 打赏
  • 举报
回复
可以直接这样用..
Caption := Base64Decode(IdMessage.From.Text);
Caption := Base64Decode(IdMessage.Subject.Text);
以下是自己写的,利用Indy9內建De/EncoderMIME解码..

//------------------------------------------------------------------------------
//Base64Decode
//------------------------------------------------------------------------------
function TMainForm.Base64Decode(strInput : string) : string;
var
strDecode : string;
posStart: Integer;
posEnd : Integer;
begin
while pos('=?gb2312?b?',lowercase(strInput)) > 0 do
begin
try
posStart := pos('=?gb2312?b?',lowercase(strInput));
posEnd := pos('?=',lowercase(strInput));
strDecode := strDecode + copy(strInput,1,posStart-1) + IdDeMIME.DecodeString(copy(strInput,posStart+11,posEnd-posStart-11));
strInput := copy(strInput,posEnd+2,length(strInput)-posEnd-1);
finally
Application.ProcessMessages;
end;
end;
strDecode := strDecode + strInput;
result := strDecode;
end;

//------------------------------------------------------------------------------
//Base64Encode
//------------------------------------------------------------------------------
function TMainForm.Base64Encode(strInput : string) : string;
var
strEncode : string;
begin
strEncode := IdEnMIME.EncodeString(strInput);
result := strEncode;
end;

//------------------------------------------------------------------------------
PS.
IdDeMIME是IdDecoderMIME
IdEnMIME是IdEncoderMIME

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧