如何做到類似郵件預覽的功能?? |
答題得分者是:qoo1234
|
jojoboy
初階會員 發表:65 回覆:108 積分:34 註冊:2002-03-13 發送簡訊給我 |
小弟最近因為工作需要,所以要做一個小程式,可以預覽Mail Server中所備份的郵件檔案.....
我試著用以下的程式碼來達到此功能...但有兩個問題一直無法突破...
不知有沒有前輩可以解惑....
問題一:以下的程式碼,只可以預覽到內文的內容...但無法得到寄件者.收件者.標題等資訊.....
問題二:有些郵件出現的都是亂碼..經我查詢以前文章時,發覺到有些郵件必須使用TIdDecoderMIME這個Indy元件,才可以做解碼的動作...但...我試著使用一段程式碼將StringStream的內容做Decode的動作時..卻無任何的反應..都是空白的..不知我是那兒寫錯了....
望各方前輩不吝指教.......Thanks //只能秀出內文
procedure TForm1.Button1Click(Sender: TObject);
var StringStream:TStringStream;
FileStream : TFileStream;
begin
FileStream := TFileStream.Create(FileListBox1.FileName,fmOpenRead);
FileStream.Position:=0; StringStream := TStringStream.Create('');
StringStream.CopyFrom(FileStream,FileStream.Size);
StringStream.Position:=0;
RichEdit1.Lines.LoadFromStream(StringStream);
FileStream.Free;
StringStream.Free;
end; //試著做Decode的動作.....但只秀出空白....
procedure TForm1.Button2Click(Sender: TObject);
var
DecodeStream:TMemoryStream;
StringStream:TStringStream;
FileStream : TFileStream;
begin
try
FileStream := TFileStream.Create(FileListBox1.FileName,fmOpenRead);
FileStream.Position:=0; StringStream := TStringStream.Create('');
StringStream.CopyFrom(FileStream,FileStream.Size);
StringStream.Position:=0; DecodeStream := TMemoryStream.Create;
DecodeStream.Position:=0; IdDecoderMIME1.DecodeToStream(StringStream.DataString,DecodeStream); RichEdit1.Clear;
RichEdit1.Lines.LoadFromStream(DecodeStream); finally
FileStream.Free;
StringStream.Free;
DecodeStream.Free;
end;
end;
|
qoo1234
版主 發表:256 回覆:1167 積分:659 註冊:2003-02-24 發送簡訊給我 |
問題】請問TIdBase64decoder如何使用?
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=33410
[推薦] MIME 和 BASE64 編碼/解碼程序代碼
http://delphi.ktop.com.tw/topic.php?topic_id=19939
【Delphi】【問題】關於 Indy 的 client-side IdPOP3 使用問題
http://delphi.ktop.com.tw/topic.php?topic_id=20737
【問題】以telnet直接取得郵件內容的實作
http://delphi.ktop.com.tw/topic.php?topic_id=27115
【問題】誰用過IDSMTP發送郵件?請進來一下.
http://delphi.ktop.com.tw/topic.php?topic_id=20748
【Delphi】【發表】[VCL Howto 投稿] Indy 9.0.10 TIdSMTP & TIdMessage
http://delphi.ktop.com.tw/topic.php?topic_id=20961
【Delphi】【發表】Indy E_mail小精靈word部分
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=21399
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=21398
【轉貼】解碼mime郵件的代碼
http://delphi.ktop.com.tw/topic.php?topic_id=22408
【問題】有什么构件可以解析MIME
http://delphi.ktop.com.tw/topic.php?topic_id=28343 網海無涯,學無止境!
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |