全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1806
推到 Plurk!
推到 Facebook!

電子郵件帳號中憑證寫入的問題

缺席
kaija
一般會員


發表:16
回覆:14
積分:6
註冊:2003-07-24

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-08-26 17:42:53 IP:61.222.xxx.xxx 未訂閱
請問有辦法在電子郵件的帳號中寫憑證到帳號裏面嗎 看了版上關於電子憑證寫入的問題 好像到最後都沒有答案 在outlook中有提供一個屬性 usercertificate 可是這個屬性好像沒辦法寫入憑證(讀出來記得好像可以) 或是有其它的辦法能寫入憑證檔到電子郵件裏面嗎
pgdennis
資深會員


發表:41
回覆:526
積分:443
註冊:2002-05-23

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-08-28 13:46:12 IP:218.163.xxx.xxx 未訂閱
1.使用元件的方式可以,我試了網路上找到的元件,你可參考 http://www.chilkatsoft.com/chilkatCertRef.asp#certProp,在download頁中請下載Chilkat Mail ActiveX及FREE Certificate ActiveX兩個元件,並安裝. 2.安裝好後,才會有delphi需要的type lib檔,他網站是的範例是用VB的,我改寫成delphi了,可以work.你可以先下載其他範例 class="code">unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, CHILKATCERTIFICATELib_TLB, OleCtrls, CHILKATMAILLib_TLB; type TForm1 = class(TForm) BitBtn1: TBitBtn; ChilkatMailMan1: TChilkatMailMan; ChilkatCreateCS1: TChilkatCreateCS; Memo1: TMemo; procedure BitBtn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.BitBtn1Click(Sender: TObject); var email:ChilkatEmail; EmailF:TEmailFactory; ChilkatCert1:ChilkatCert; success:longint; begin //' Find the certificate that we will use to sign the email. // ChilkatCreateCS1 is a ChilkatCreateCS object that has been // dropped onto the Visual Basic form. //find的方法有很多,我是用serial number,這個你可以跑show list的範例就可以知道了,網站上有,vb寫的 ChilkatCert1:=(ChilkatCreateCS1.OpenCurrentUserStore as IChilkatCertStore).FindCertBySerial('3e77b70b'); // We could've loaded the certificate from a DER encoded X.509 .cer file. //Set cert = New ChilkatCert //cert.LoadFromFile "matt.cer" // Get an evaluation unlock-code from http://www.chilkatsoft.com/register30.asp ChilkatMailMan1.UnlockComponent('UnlockCode'); // Set our SMTP server to be used for sending signed mail. ChilkatMailMan1.SmtpHost := 'tchsmtp1.aidc.com.tw'; // Only set username/password if your SMTP server requires a logon. //mailman.SmtpUsername = "your_username" //mailman.SmtpPassword = "your_password" // Only set the login domain if your SMTP server uses integrated Windows authorization // AND it is part of a domain. //mailman.SmtpLoginDomain = "your_domain" // Assign the cert to the email so that it is used when signing the email. EmailF:=TEmailFactory.Create(application); email:=EmailF.NewEmail; email.SetSigningCert(CHILKATMAILLib_TLB.IChilkatCert(ChilkatCert1)); email.AddTo ('Email Expert', 'chiahaodai@ms.aidc.com.tw'); email.Subject := 'This is the subject'; email.Body := 'This is the body'; email.From := 'matt@chilkatsoft.com'; // Indicate that the email should be sent digitally signed. // When sending a signed email, the private key is used, so the private key // associated with the chosen certificate must be installed on the system. email.SendSigned := 1; // Send mail. Returns 1 for success, 0 for failure success := ChilkatMailMan1.SendEmail(email); // Display the details of the certificate used in signing. memo1.Lines.Add('Sent signed email with certificate'); memo1.Lines.add('certificate serial number: ' chilkatCert1.SerialNumber); memo1.Lines.add('certificate subject common name:' ChilkatCert1.SubjectCN ); memo1.Lines.add('certificate subject email: ' ChilkatCert1.SubjectE ); // Save the log regardless of success/failure ChilkatMailMan1.SaveXmlLog('log.xml'); end; end. 永遠追不上技術更新的速度
------
星期一,二...無窮迴圈@@
kaija
一般會員


發表:16
回覆:14
積分:6
註冊:2003-07-24

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-08-28 14:54:01 IP:61.222.xxx.xxx 未訂閱
ㄛ…除了引用外部元件是否有其它的辦法呢 使用外部元件是有比較快速 但我們無法掌控整個外部元件的執行過程 所以外部元件並不列入小弟的考慮範圍 @@~ 還是很謝謝你的幫忙 ^^
系統時間:2024-05-04 19:39:24
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!