出自VFP Wiki
使用MSMAPI
來源
提供者
環境
範例
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
來源
提供者
- 由狐友violet提供
- 傳遞 html 格式與附件,是由狐友 erwin_ho 提供.
環境
範例
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") <--傳附件