線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:3116
推到 Plurk!
推到 Facebook!

Delphi 2010 寫郵件發送程式

尚未結案
g9221712
高階會員


發表:145
回覆:344
積分:162
註冊:2006-07-06

發送簡訊給我
#1 引用回覆 回覆 發表時間:2010-02-06 03:12:04 IP:122.117.xxx.xxx 訂閱
請問各位前輩:
如下標示黃色的字體,在Delphi7使用都沒有問題,可是一轉到Delphi 2010 卻只能
使用// 這一行本來Delphi 7可以,但是到Delphi 2010就不行了
af := TIdAttachmentFile.Create(idMessage1.MessageParts, 'c:\test.txt');


// set up the SMTP component
IdSMTP1.Host := 'myhost.mycompany.com';
IdSMTP1.MailAgent := 'My Mail';
IdSMTP1.UserName := 'felix';
IdSMTP1.HeloName := 'felix';
IdSMTP1.Password := 'my password';
IdSMTP1.Port := 25;
IdMessage1.From.Text := 'Felix ';

{ the rest of the setup is done once the file (stFileName) has been created and the list of recipients (st) has been determined, called by a button click }
IdMessage1.BccList.EmailAddresses := st; // list collected from a table

af.FileName := stFileName;

IdSMTP1.Connect;

IdSMTP1.Send(IdMessage1); { wasn't crashing until it tried to attach the file, back when I was able to compile my project. I haven't changed any code since installing the latest indy tiburon }

IdSMTP1.Disconnect;
------
「人們所以覺得寂寞,是因為他們會築牆,卻不會搭橋。」
程式寫的越久,卻發現自己越來越不會寫程式!
編輯記錄
g9221712 重新編輯於 2010-02-07 02:38:39, 註解 無‧
g9221712 重新編輯於 2010-02-07 02:39:24, 註解 無‧
g9221712 重新編輯於 2010-02-08 03:25:20, 註解 無‧
g9221712 重新編輯於 2010-02-08 03:26:27, 註解 不知道有無人知道Indy 10.5.5 於TIdAttachmentFile操作資訊‧
firesu
中階會員


發表:26
回覆:28
積分:55
註冊:2004-12-27

發送簡訊給我
#2 引用回覆 回覆 發表時間:2010-02-12 11:08:51 IP:61.59.xxx.xxx 未訂閱
uses IdAttachmentFile

var IdAttachment : TIdAttachmentFile;

IdAttachment := TIdAttachmentFile.Create(IdMessage1.MessageParts,'C:\temp\222.txt');

這樣可以run
g9221712
高階會員


發表:145
回覆:344
積分:162
註冊:2006-07-06

發送簡訊給我
#3 引用回覆 回覆 發表時間:2010-02-12 12:17:01 IP:122.117.xxx.xxx 訂閱
我測試一樣不行,請問您是在Delphi 2010測試嗎?Indy 10.5.5
------
「人們所以覺得寂寞,是因為他們會築牆,卻不會搭橋。」
程式寫的越久,卻發現自己越來越不會寫程式!
firesu
中階會員


發表:26
回覆:28
積分:55
註冊:2004-12-27

發送簡訊給我
#4 引用回覆 回覆 發表時間:2010-02-22 17:11:01 IP:61.59.xxx.xxx 未訂閱
是低
系統時間:2024-03-29 23:36:16
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!