当前位置: 代码迷 >> VFP >> 急高手指导! vfp 发送邮件解决办法
  详细解决方案

急高手指导! vfp 发送邮件解决办法

热度:4441   发布时间:2013-02-26 00:00:00.0
急,高手指导!!!! vfp 发送邮件
WITH thisform.mAPISESS 
.logonui=.F.
.downloadmail=.f.
.signon
ENDWITH 
aa=GETFILE()
mymessage(aa)
thisform.maPIMESS.sessionID=thisform.maPISESS.sessionID 
WITH thisform.mAPIMESS 
.msgindex=-1
.compose
.recipdisplayname=ALLTRIM(thisform.text1.Value)
.msgsubject=ALLTRIM(thisform.text2.value)
.msgnotetext=thisform.edit1.Value 
.attachmentindex=1
.AttachmentPathName=aa
.attachmenttype=1
.send(1)
ENDWITH 
thisform.maPISESS.signoff


上述代码,运行send()方法时,老是出现,attachment not found 不知道是怎么回事
还请高手指点

------解决方案--------------------------------------------------------
转帖:
用CDO发送邮件
*------------

There reason CDO2.0 avoids the security patch of Outlook is, it does not require Outlook to work. (Thank you Jonscott8 for this clarification)
Note #1 : This requires SMTP services installed and running on the local computer.
Note: If a mail server is involved (ie: Exchange server ) consider using the suggestions in FAQ184-1769.

oMSG = CREATEOBJECT('cdo.message')
oMSG.To = 'me@nowhere.com'
oMSG.From = 'me'
oMSG.Subject = 'Hello Email'
oMSG.TextBody = 'This is an easy way to create an email'
oMSG.Send()
release oMSG

*--带附件发送邮件
oMSG = createobject('CDO.Message')
oMSG.To = 'me@nowhere.com'
oMSG.From = 'me@nowhere.com'
oMSG.Subject = 'Hello Email'
oAtt=oMSG.AddAttachment('c:\myfile.txt')
oMSG.Send()
release oMSG

*--Here is a great way to embed your web page in your email:
CODEoMSG = createobject('CDO.Message')
oMSG.To = 'me@nowhere.com'
oMSG.From = 'me@nowhere.com'
oMSG.Subject = 'Hello Email'
oMSG.CreateMHTMLBody('http://www.slpcanada.com')
oMSG.Send()
release oMSG

*--发送HTML格式邮件
CODE
oMSG = createobject('CDO.Message')
oMSG.To = 'me@nowhere.com'
oMSG.From = 'me@nowhere.com'
oMSG.Subject = 'Hello Email'
oMSG.HTMLBody = [< b >< P >< FONT COLOR='#CC0000' >Hello In Color< /FONT >< /b >]
oMSG.Send()
release oMSG
------解决方案--------------------------------------------------------
先把 AttachmentType 属性改成 0 再说
另外,AttachmentIndex 属性是从 0 开始计数的
  相关解决方案