如何寄信
出自VFP Wiki
(修訂版本間差異)
小 (revert) |
|||
| 第78行: | 第78行: | ||
===使用JMail=== | ===使用JMail=== | ||
請參考 Ruey 提供的連結. | 請參考 Ruey 提供的連結. | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
在2005年4月3日 (日) 07:56所做的修訂版本
目錄 |
使用MSMAPI
來源
- http://fox.hanyu.com.tw/View.aspx?fbId=7&Id=7717
- http://fox.hanyu.com.tw/View.aspx?fbId=1&Id=17394
- http://fox.hanyu.com.tw/View.aspx?fbId=1&Id=15910
- http://fox.hanyu.com.tw/View.aspx?fbId=1&Id=351
- VFP目錄下的...\samples\solution\ole\sendmail.scx
- http://vfp.sunyear.com.tw/viewtopic.php?t=27&highlight=FTP (Ruey)
提供者
- 狐友 saint
- Ruey
環境
- 需安裝 Office
範例
oSession = CREATEOBJECT("MSMapi.MapiSession")
oMessage = CREATEOBJECT("MSMapi.MapiMessages")
oSession.LogonUI = .t.
oSession.SignOn
*-- The message control needs to reference the session control's ID.
oMessage.SessionID = oSession.SessionID
oMessage.MsgIndex = -1
*-- Set up our message and send it.
oMessage.Compose
oMessage.msgsubject = "Attachments sent using FoxPro and MAPI"
oMessage.msgnotetext = " Attached are some test files."
*-- Create an array holding the attachment file names.
DIMENSION lcAttachment(2)
lcAttachment(1) = home()+ "samples\data\customer.dbf"
lcAttachment(2) = home()+ "samples\data\customer.cdx"
*-- Attach the files.
FOR lnCount = 1 TO ALEN(lcAttachment)
oMessage.AttachmentIndex = lnCount - 1
oMessage.AttachmentPathName = lcAttachment(lnCount)
ENDFOR
*-- Send the message on its way.
oMessage.send(1)
使用CDO
來源
- http://fox.hanyu.com.tw/View.aspx?fbId=1&Id=18075
- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_imessage_interface.asp
提供者
- 由狐友violet提供
- 傳遞 html 格式與附件,是由狐友 erwin_ho 提供.
環境
- Windows 版本: 2000 以後的版本
範例
oMSG = createobject("CDO.Message")
oMSG.To = "violet@kkk.com.tw"
oMSG.From = "violet@kkk.com.tw"
oMSG.Subject = "Hello Email"
oMSG.TextBody = "This is an easy way to create an email"
oMSG.Send()
RELEASE omsg
oMSG.HTMLBody="傳HTML格式"
=oMSG.addattachment("C:\TEST.TXT") <--傳附件
使用JMail
請參考 Ruey 提供的連結.